Commit Graph

15 Commits

Author SHA1 Message Date
efabbd3b2e fix(modal): stop untrusted content reaching innerHTML and the iframe
Every one of these paths checked a string that the browser reinterprets
afterwards. isSafeUrl now hangs the value on an <a> and reads back
probe.protocol, so the check sees what the browser will see: a pre-parse
test reads "&#106;avascript:" as a relative path and passes it, and the
HTML parser then decodes it to "javascript:".

marked passes raw HTML through and emits hrefs unescaped. renderMarkdown
escapes the angle brackets before parsing, parses into an inert DOMParser
document where no script runs and no image loads, and drops anchors and
images whose scheme is not http, https or mailto. Blockquotes and
<autolinks> stop working as a result; neither appears in the configuration.

modalTitle and the alternatives list interpolated subitem.name and
icon.class into innerHTML. Both are built as nodes now. name is a
translatable key, so it arrives from the machine-written catalogues.

The link kept its click handler and its class across popups, because one
anchor serves all of them: a later, unrelated click opened whatever an
earlier popup pointed at, and addEventListener stacked one handler per
open. Both are reset per popup and the handler is assigned, not added.

openIframe guards its own argument. Removing the href alone left the
handler passing the raw URL on, and ?iframe= in the query string reaches
the same sink with no configuration involved at all.

Verified in headless Chromium: decimal and hex character references,
&Tab;- and &NewLine;-split schemes, reference-style links, raw HTML as a
link's text, and the two name sinks all executed before these changes.
injection.spec.js keeps all fifteen payloads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 01:18:29 +02:00
19f47a82fa Implemented iframe logic for modals 2025-03-19 17:16:44 +01:00
0f8113974f Refactored warning and info js 2025-01-17 01:07:48 +01:00
a0664691e6 Refactored alternatives and options js 2025-01-17 01:04:27 +01:00
0360c443b7 Solved childrens selector bug 2025-01-17 00:59:26 +01:00
954cff051a Added children 2025-01-17 00:44:28 +01:00
3c240fc16b Solved bug 2025-01-09 16:34:35 +01:00
2a3491b98b Added warnings 2025-01-09 16:30:38 +01:00
378ee4632f Finish modals 2025-01-09 15:57:39 +01:00
19f99ff9d3 Optimized description 2025-01-09 15:46:45 +01:00
a9fcd4b6de Solved close modals bug 2025-01-09 15:38:48 +01:00
e303968ca5 Solved bugs 2025-01-09 15:34:32 +01:00
f85dc5bb18 Removed allerts 2025-01-09 15:19:37 +01:00
562f5989e1 Solved identifier bug 2025-01-09 15:17:34 +01:00
9455f40079 Optimized modals 2025-01-09 14:59:30 +01:00