luci-mod-system: sshkeys.js: prevent XSS through pubkey comments

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 944b55738e)
This commit is contained in:
Jo-Philipp Wich 2022-09-21 14:47:41 +02:00
parent 712bc8e52d
commit f25285a6c2

View 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([], [