Skip to content

net/upnp: Improve ACL validation, update changelog - #5677

Open
Self-Hosting-Group wants to merge 1 commit into
opnsense:masterfrom
Self-Hosting-Group:acl-validation
Open

Self-Hosting-Group wants to merge 1 commit into
opnsense:masterfrom
Self-Hosting-Group:acl-validation

Conversation

@Self-Hosting-Group

@Self-Hosting-Group Self-Hosting-Group commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • Improve ACL entry validation to remove unnecessary spaces
  • Move Disable IPv6 mapping option to better place and update changelog

Fixes: #5371

Important notices

Before you submit a pull request, we ask you kindly to acknowledge the following:

@Self-Hosting-Group

Copy link
Copy Markdown
Contributor Author

@fichtner Ping

@Self-Hosting-Group
Self-Hosting-Group force-pushed the acl-validation branch 5 times, most recently from 0100b2d to b121b14 Compare September 10, 2026 05:01
Comment thread net/upnp/pkg-descr Outdated
Plugin Changelog
================

1.9_2???

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisions are not new versions so keep adding 1.9 updates to 1.9 or add 1.10 (I'd avoid 2.0 until MVC rewrite happens)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed it to 1.10. 2.0 was also my idea for the MVC rewrite.

/* user permissions validation */
foreach (miniupnpd_permuser_list() as $i => $permuser) {
if (!empty($pconfig[$permuser])) {
$perm = explode(' ', $pconfig[$permuser]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's wrong with this? adding trim() is not the best idea to validation, because it can obscure issues and force premature normalization.

if you accept the trim but don't store it trimmed you'll always have two different ways to address the same value. it it much easier to discard wrong values even if they just have an extra space so the user can remote that.

in mvc there is also getValues() which can normalize and filter value lists much better

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you accept the trim but don't store it trimmed you'll always have two different ways to address the same value. it it much easier to discard wrong values even if they just have an extra space so the user can remote that.

Yes, I was aware that this was a hack. It should be cleaner this way, normalised string is directly used now. I like that it removes also multiple spaces between the fields, which can happen when you copy-paste an IP address to an existing entry.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok fine, thanks

Comment thread net/upnp/src/www/services_upnp.php Outdated
}
foreach (miniupnpd_permuser_list() as $fieldname) {
$upnp[$fieldname] = $pconfig[$fieldname];
$upnp[$fieldname] = implode(' ', preg_split('/\s+/', trim($pconfig[$fieldname])));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, you're going on a goose chase due to the above change already

@Self-Hosting-Group

Copy link
Copy Markdown
Contributor Author

If this PR is better now, and if there isn't a new OPNsense release this week, I’d prefer not to merge this PR just yet, and to keep it open.

@fichtner fichtner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving open as requested -- but be aware I may grab this next week in order to finish the release (if I don't forget)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants