Skip to content

PT-5057: Update the bundled DOMPurify past its security advisories - #54

Open
siltomato wants to merge 1 commit into
mainfrom
pt-5057-dompurify
Open

siltomato wants to merge 1 commit into
mainfrom
pt-5057-dompurify

Conversation

@siltomato

@siltomato siltomato commented Nov 12, 2026 •

Copy link
Copy Markdown

Code Review Summary

Branch: pt-5057-dompurify

Base: origin/main

Date: 2026-11-17

Review model: Claude Opus 5.5

Files changed: 5

Overview

This updates the DOMPurify that platform-editor bundles from 3.4.13 to 3.4.18. That clears five published advisories, all fixed in 3.4.17:

It also takes 3.4.18's further SAFE_FOR_TEMPLATES fix. The changes:

  • libs/shared-react raises its dompurify floor to ^3.4.18, and the lockfile changes only dompurify.
  • The committed packages/platform/dist is rebuilt.
  • The CHANGELOG gets a ### Security line.

This is the editor half of PT-5057, which fixes the known advisories in what Paratext 10 ships and adds a check to run before each release. The core half is paranext/paranext-core#3021.

The editor's only DOMPurify call, DOMPurify.sanitize(html) in StructureKeyboardPlugin.tsx, uses the default config. Every advisory here needs IN_PLACE, SAFE_FOR_TEMPLATES, PARSER_MEDIA_TYPE or hooks, so none could be reached through the editor and the real exposure was low.

API Changes

None. The public API of the published packages is unchanged:

  • In packages/platform, etc/*.api.md and dist/index.d.ts are untouched.
  • dist/index.js keeps the same export block, external modules and imported names. Only a local alias for the quill-delta default import is renamed.
  • dompurify is bundled and isn't listed in packages/platform/package.json, so consumers' dependency trees don't change.

Findings

Critical — Must address before merge

None.

Important — Should address before merge

None.

Minor — Consider

  • The commit message didn't name the advisories the update closes, which docs/dependency-updates.md step 9 asks for. The PR body and CHANGELOG counted them without naming them. (fixed during review: the commit message and the PR body name the five GHSA IDs and say no overrides were needed. The CHANGELOG line keeps the count.)
  • The CHANGELOG could say the advisories aren't reachable through the editor's default-config use of DOMPurify. (no change: the PR body explains the low exposure, and the CHANGELOG entry is accurate as written)
  • Most of the dist/index.js diff is minifier renaming. Only the DOMPurify source changed, and CI confirmed the committed output is current. (informational, no change)

The author accepted the recommendations: name the advisories in the commit message and the PR body, and make no other change.

Template Propagation

Shared Regions Modified

None.

Extension Config Changes

None. This repository has no extensions/ directory.

Positive Observations

  • The rebuilt dist contains only this change. Of the 197 sources in index.js.map, only the DOMPurify entry changed (3.4.13 → 3.4.18); every other sourcesContent entry is byte-identical.
  • No reference to 3.4.13 remains outside the CHANGELOG, and libs/shared-react is the only manifest that declares dompurify.
  • The advisory counts match GitHub's advisory database, which lists none for 3.4.18. pnpm audit reports no dompurify advisories.
  • The consumer-lockfile rule is met. paranext-core needs no lockfile change, because shared-react is a devDependency of platform-editor.
  • ### Security is the last subsection of Unreleased, where Keep a Changelog puts it.
  • CI is green, including the check that the committed build output is current.

Interview Notes

  • Purpose: to fix the known security advisories and add a mechanism for checking before each release. This PR covers the editor's bundled DOMPurify; the check lives in PT-5057: Fix shipped npm advisories and add an audit:shipped check paranext-core#3021.
  • Findings: none critical or important. The author accepted all three minor recommendations.
  • No open Dependabot PR covers dompurify, so step 10's @dependabot rebase comment doesn't apply.

Suggested Review Focus


Updates the DOMPurify that platform-editor bundles from 3.4.13 to 3.4.18. That clears its five published security advisories, all fixed by 3.4.17:

It also takes 3.4.18's further SAFE_FOR_TEMPLATES fix. No overrides were needed.

  • libs/shared-react raises its dompurify floor to ^3.4.18. The lockfile change touches only dompurify.
  • packages/platform/dist is rebuilt with pnpm rebuild-committed-output. Most of the index.js diff is the minifier renaming identifiers across the bundle; the substantive change is DOMPurify's own code.
  • CHANGELOG.md gets a ### Security line under Unreleased.

The paste path calls DOMPurify with default options, not the IN_PLACE, SAFE_FOR_TEMPLATES or XHTML options the advisories need, so the real exposure is low. paranext-core needs no lockfile change, because shared-react is a devDependency of platform-editor.

Testing: pnpm nx affected -t lint test --base=origin/main and the platform-editor typecheck pass. verify-committed-dist reports the committed output current. The bundle carries only DOMPurify 3.4.18.

After merge: move platform-yalc so paranext-core's main picks this up. Release builds get it when release-prep next takes main. Open PRs that commit dist will need the usual rebuild on rebase.

Jira: PT-5057

🤖 Generated with Claude Code


This change is Reviewable

@siltomato
siltomato marked this pull request as draft November 13, 2026 23:02
@siltomato siltomato changed the title PT-5057: Update the bundled DOMPurify to 3.4.17 PT-5057: Update the bundled DOMPurify past its security advisories Nov 13, 2026
@siltomato
siltomato force-pushed the pt-5057-dompurify branch 2 times, most recently from 5552e05 to 6a75010 Compare November 17, 2026 03:37
@siltomato
siltomato marked this pull request as ready for review November 17, 2026 18:02
Clears GHSA-cg2g-xh64-v4q7 (critical), GHSA-mrv2-3pqr-j5jr (high), and
GHSA-c6gr-qvv4-5v3f, GHSA-6688-9rhm-gjv2 and GHSA-p98j-92pf-mc4p (low),
all fixed in 3.4.17. 3.4.18 adds a further SAFE_FOR_TEMPLATES fix. No
overrides were needed.

Co-Authored-By: Claude Opus 5.5
@siltomato
siltomato marked this pull request as draft November 17, 2026 20:01
@siltomato
siltomato marked this pull request as ready for review November 19, 2026 16:21

@jolierabideau jolierabideau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that the rebuilt bundle changes only DOMPurify's source (sourcemap diff: 1 of 197 sources changed, 3.4.13 → 3.4.18) and the lockfile has no older dompurify left. The paste path's existing tests cover the sanitize call. Once platform-yalc moves, a quick manual HTML paste in paranext-core would cover the ticket's "HTML paste still works" testing idea from start to finish.


### Security

- Bundled DOMPurify updated from 3.4.13 to 3.4.18, past its published security advisories (one

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: consider naming the five GHSA IDs here, as the commit message does. paranext-core readers see this CHANGELOG but not our commit log, and a count alone can't be checked against an advisory scanner. Fine to keep as-is if the CHANGELOG convention is counts only.

"@lexical/react": "^0.43.0",
"@lexical/utils": "^0.43.0",
"dompurify": "^3.4.13",
"dompurify": "^3.4.18",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Raising the floor rather than only re-locking means a future lockfile regeneration can't quietly fall back to a vulnerable 3.4.x.

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.

2 participants