fix(lr-7b07): XSS - sticky-note href breakout + escapeHtml quote/null fixes#220
Merged
Conversation
…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 " -> " and ' -> ' 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regression tests + fixes for three frontend XSS defects (lr-7b07). See PR description.