From dae15b8cf476fe761b2b6a7457c4d8e3e9950569 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 12 May 2020 14:45:47 +0200 Subject: luci-proto-wireguard: verify last base64 string symbol is an = sign Signed-off-by: Florian Eckert --- .../htdocs/luci-static/resources/protocol/wireguard.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol') diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index 49f61c782a..e88c07c339 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -10,6 +10,9 @@ function validateBase64(section_id, value) { if (value.length != 44 || !value.match(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)) return _('Invalid Base64 key string'); + if (value[43] != "=" ) + return _('Invalid Base64 key string'); + return true; } -- cgit v1.2.3