luci-proto-wireguard: verify last base64 string symbol is an = sign 4047/head
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 12 May 2020 12:45:47 +0000 (14:45 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Thu, 14 May 2020 07:44:50 +0000 (09:44 +0200)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

index 49f61c782a1459a2127f16202b0e905ee7eeb233..e88c07c339ba532f4f319e600fbc9f31d92def6a 100644 (file)
@@ -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;
 }