Skip to content

security: upgrade notebookjs and route ipynb HTML through DOMPurify - #8330

Merged
unknwon merged 1 commit into
mainfrom
GHSA-6vxv-wg6j-5qwp
Jun 7, 2026
Merged

unknwon merged 1 commit into
mainfrom
GHSA-6vxv-wg6j-5qwp

Conversation

@unknwon

@unknwon unknwon commented Jun 7, 2026

Copy link
Copy Markdown
Member

notebookjs 0.4.2 builds the rendered notebook by assigning marked.parse(source) to innerHTML on detached elements, so raw HTML in a markdown cell (e.g. <img onerror=...>) executes immediately, before the server-side sanitizer ever sees the document.

Upgrade notebookjs to 0.8.3 and load DOMPurify alongside it. The new notebookjs pipes every innerHTML assignment through nb.sanitizer, which resolves to DOMPurify.sanitize at load time, so attacker HTML is neutralized before it can run.

The now-redundant client-side scheme filter and post-sanitize re-render are removed from the view template. Relative image source prefixing is kept and moved to a direct DOM walk.

Advisory: GHSA-6vxv-wg6j-5qwp

@unknwon
unknwon force-pushed the GHSA-6vxv-wg6j-5qwp branch from 99a0440 to abd2698 Compare June 7, 2026 01:44
@unknwon unknwon added this to the 0.14.3 milestone Jun 7, 2026
@unknwon
unknwon force-pushed the GHSA-6vxv-wg6j-5qwp branch from abd2698 to 773e43f Compare June 7, 2026 01:49
notebookjs 0.4.2 built the rendered notebook by assigning
marked.parse(source) to innerHTML on detached elements, so raw HTML in
a markdown cell (e.g. <img onerror=...>) executed immediately, before
the server-side sanitizer ever saw the document.

Upgrade notebookjs to 0.8.3 and load DOMPurify alongside it. The new
notebookjs pipes every innerHTML assignment through nb.sanitizer,
which resolves to DOMPurify.sanitize at load time, so attacker HTML is
neutralized before it can run.

Drop the now-redundant client-side scheme filter and post-sanitize
re-render from the view template. The relative-image-source prefixing
is kept and moved to a direct DOM walk.
@unknwon
unknwon force-pushed the GHSA-6vxv-wg6j-5qwp branch from 773e43f to bf867f6 Compare June 7, 2026 01:54
@unknwon
unknwon merged commit 5c9c40a into main Jun 7, 2026
2 checks passed
@unknwon
unknwon deleted the GHSA-6vxv-wg6j-5qwp branch June 7, 2026 01:57
unknwon added a commit that referenced this pull request Jun 7, 2026
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