]> git.proxmox.com Git - proxmox-widget-toolkit.git/commit
parser: split checking IMG and A tags, make the latter more strict
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 3 Oct 2023 07:43:47 +0000 (09:43 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 3 Oct 2023 08:31:18 +0000 (10:31 +0200)
commit89699c6466cfd9cc3a81fbc926b62f122c33c23c
tree272e5e322a601429c47bf4c45e4663b2e5a92e84
parent9ef8030535df0043e59c3bf667dac58ca9400589
parser: split checking IMG and A tags, make the latter more strict

Split the logic so that each tag is handled explicitly on it's own
if-else branch, which is now safer to do as we default to
allow-only-http-like.

Also address a recently introduced regression from the implementation
of the #4756 where any user that could edit notes could use
javascript: script-urls for XSS purpose to prepare a link that could
leak private user information when another user clicked on it, at
least if they omitted basic sanity checks by looking at the URL
displayed by the browser before.

We have to override a false-positive triggered by a eslint heuristic,
a simple string compression should be always safe.

Fixes: 5cbbb9c ("fix #4756: markdown notes: allow any valid URL for a tags")
Reported-by: Hieu Dang Cong <HieuDC5@fpt.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/Parser.js