summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-firewall/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-10-12 09:38:46 +0200
committerJo-Philipp Wich <jo@mein.io>2023-10-12 09:39:53 +0200
commit755edf6fbf65fa2f6b778e7edfd8b56fd1742f70 (patch)
treef19dcc920fa99179905639a39a271f3e549db707 /applications/luci-app-firewall/htdocs/luci-static/resources
parent4798cb4aa37749678ec9f02fc071670b0528a0c0 (diff)
firewall: ipsets.js: validate set names
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>
Diffstat (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources')
-rw-r--r--applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/ipsets.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/ipsets.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/ipsets.js
index c9f3e1131a..40d47cb2e4 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/ipsets.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/ipsets.js
@@ -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: '' });