Skip to content

fix(lr-7b07): XSS - sticky-note href breakout + escapeHtml quote/null fixes#220

Merged
akuehner merged 1 commit into
mainfrom
fix/lr-7b07-xss-escaphtml
Jun 11, 2026
Merged

fix(lr-7b07): XSS - sticky-note href breakout + escapeHtml quote/null fixes#220
akuehner merged 1 commit into
mainfrom
fix/lr-7b07-xss-escaphtml

Conversation

@akuehner

Copy link
Copy Markdown
Member

Regression tests + fixes for three frontend XSS defects (lr-7b07). See PR description.

…ding and null coercion

5a: Tighten auto-link regex in sticky-notes.js fmt() from [^\s<]+ to
[^\s<>"']+ so a URL containing a double or single quote (e.g.
http://x.com"onmouseover="alert(1)) cannot break out of the href
attribute and inject event handlers. Stored cross-user XSS via
note_update/note_created broadcast.

5b: Extend escapeHtml (escape-html.js) to encode " -> &quot; and
' -> &#39; in addition to & < >. Without quote escaping, attacker-
controlled values in attribute contexts (alt="...", title="...") can
inject arbitrary event handlers.

5c: Coerce non-string input in escapeHtml via String(s == null ? "" : s)
so callers that receive null/undefined from the server never crash mid-
innerHTML build.

Implementation: escapeHtml extracted to lib/public/modules/escape-html.js
(DOM-free, Node-importable). utils.js re-exports it. sticky-notes-fmt.js
mirrors the DOM-free fmt() logic for Node-based regression tests.

Regression tests added in test/xss-escape.test.js — 15 tests covering all
three defects using real production module code.
@akuehner akuehner merged commit 9c4ad71 into main Jun 11, 2026
1 check passed
@akuehner akuehner deleted the fix/lr-7b07-xss-escaphtml branch June 11, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant