Skip to content

Commit 2865dad

Browse files
authored
security: client-side sanitize snapshot HTML (#110)
Defense-in-depth: run snapshot HTML through DOMPurify before injecting it via innerHTML in the viewer and embed, using the same allowlist the server-side SnapshotHtmlSanitizer enforces (formatting tags only, no attributes). .pad bodies are attacker-writable, so XSS now requires both the server and client gate to fail. - src/lib/sanitize-html.js (sanitizeSnapshotHtml via DOMPurify), applied at both innerHTML sinks; embed derives its HTML path from the sanitized result. - jsdom-pinned unit tests (happy-dom mis-sanitizes DOMPurify). - deps: dompurify (runtime), jsdom (dev). vitest 123 + full Playwright 23/23 on NC 33; CI green incl. stale-js guard. Closes #110.
1 parent ea657d0 commit 2865dad

15 files changed

Lines changed: 666 additions & 10 deletions

js/etherpad_nextcloud-embed-main.mjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/etherpad_nextcloud-embed-main.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/etherpad_nextcloud-viewer-main.mjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/etherpad_nextcloud-viewer-main.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/pad-sync-B0gz-oBk.chunk.mjs

Lines changed: 0 additions & 2 deletions
This file was deleted.

js/pad-sync-B0gz-oBk.chunk.mjs.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

js/sanitize-html-dv-YifbT.chunk.mjs

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/pad-sync-B0gz-oBk.chunk.mjs.license renamed to js/sanitize-html-dv-YifbT.chunk.mjs.license

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/sanitize-html-dv-YifbT.chunk.mjs.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)