luci-mod-system: sshkeys.js: prevent XSS through pubkey comments openwrt-19.07
authorJo-Philipp Wich <jo@mein.io>
Wed, 21 Sep 2022 12:47:41 +0000 (14:47 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 21 Sep 2022 12:50:02 +0000 (14:50 +0200)
Ensure to not display public key comments verbatim in order to prevent
injection of markup.

Reported-by: Eric McDonald <ericmcdonald@protonmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 944b55738e7f9685865d5298248b7fbd7380749e)

modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js

index 9269a6939596babaebe571e121778864329a596c..bbb6d050d28a87666ef8fb40f790f5e7b8fa66e8 100644 (file)
@@ -109,7 +109,7 @@ function renderKeyItem(pubkey) {
                click: removeKey,
                'data-key': pubkey.src
        }, [
-               E('strong', pubkey.comment || _('Unnamed key')), E('br'),
+               E('strong', [ pubkey.comment || _('Unnamed key') ]), E('br'),
                E('small', [
                        '%s, %s'.format(pubkey.type, pubkey.curve || _('%d Bit').format(pubkey.bits)),
                        pubkey.options ? E([], [