Skip to content

Commit

Permalink
firewall: ipsets.js: validate set names
Browse files Browse the repository at this point in the history
Ensure that user supplied set name values conform to the nftables identifier
syntax constraints.

Fixes: openwrt#6633
Fixes: 0484343 ("luci-app-firewall: implement IPsets GUI")
Signed-off-by: Jo-Philipp Wich <[email protected]>
  • Loading branch information
jow- committed Oct 12, 2023
1 parent 4798cb4 commit 755edf6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ return view.extend({
o = s.option(form.Value, 'name', _('Name'));
o.optional = false;
o.rmempty = false;
o.validate = function (section_id, value) {
if (!/^[a-zA-Z_.][a-zA-Z0-9\/_.-]*$/.test(value))
return _('Invalid set name');

return true;
};
} else {
o = s.option(form.Value, 'name', _('Name'));
o.depends({ external: '' });
Expand Down

0 comments on commit 755edf6

Please sign in to comment.