Ensure that user supplied set name values conform to the nftables identifier
syntax constraints.
Fixes: #6633
Fixes: 0484343903 ("luci-app-firewall: implement IPsets GUI")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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: '' });