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 63bfee6c8d
commit 30ba277989

View file

@ -112,7 +112,7 @@ function renderKeyItem(pubkey) {
click: isReadonlyView ? null : 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([], [