Skip to content

fix: zero npm audit vulns via dompurify override (#175)#222

Closed
EVWorth wants to merge 1 commit into
mainfrom
fix/175-audit-vulnerabilities
Closed

fix: zero npm audit vulns via dompurify override (#175)#222
EVWorth wants to merge 1 commit into
mainfrom
fix/175-audit-vulnerabilities

Conversation

@EVWorth

@EVWorth EVWorth commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What

Eliminates the 2 remaining npm audit vulnerabilities (16 advisory chain on DOMPurify <=3.4.10) without downgrading monaco-editor.

Why

monaco-editor@0.55.1 hard-pins dompurify: 3.2.7 in its package.json. That version has known XSS / prototype-pollution / hook-pollution / SAFE_FOR_TEMPLATES-bypass / IN_PLACE-realm-confusion advisories (one GHSA umbrella + 15 sibling GHSAs, all chained via GHSA-v2wj-7wpq-c8vv family).

npm audit fix --force's only resolution was to roll monaco-editor backward to 0.53.0 - losing ~6 months of monaco improvements (HTML rendering, marked 14, accessibility, etc.) - for a transitive dep we never invoke at runtime in SQLPilot.

How

monaco-editor ships two builds:

  • ./esm/vs/editor/editor.main.js - consumed by Vite (our build path) - imports dompurify as an external module.
  • ./min/vs/editor/editor.main.js (CJS) + a vendored 3.2.7 copy inside min/vs/editor.api-*.js - the legacy CJS bundle, NOT used by our build.

SQLPilot uses the ESM build via Vite. Override dompurify at the npm level:

"overrides": {
  "dompurify": "^3.4.11"
}

The override forces npm to install dompurify@3.4.12 (latest) at the workspace root. monaco's ESM import resolves to this version, and Vite bundles it into the production output.

Verified: npm audit returns 0 vulnerabilities after the override.

Diff (2 files, +116/-110)

File Change
package.json +3 lines: overrides block pinning dompurify to ^3.4.11
package-lock.json refreshed by npm install; resolves dompurify 3.4.12 at workspace root, no nested copy under monaco-editor

What's NOT in this PR

  • cargo audit: already green. scripts/cargo-audit-check.sh exits 0 today (0 real vulns, 17 non-blocking unmaintained/unsound warnings on gtk-rs + unic-* + glib). KNOWN_ACCEPTED list holds 2 quick-xml advisories awaiting wayland-rs release (#206).
  • npm run deps:check: pre-existing failure on main for 5 cargo deps that landed <7 days ago (serde 1.0.229, tokio 1.53.0, uuid 1.24.0, anyhow 1.0.104, futures 0.3.33). Same Cargo.lock entries on main also fail the gate. Not introduced by this PR; flagging as a follow-up item since it would block any PR touching package.json/package-lock.json until those versions age.

Verification

Gate Result
npm audit 0 vulnerabilities
npm run build (Vite) passes, monaco chunk size unchanged (~4.2MB)
npx vitest run 77 files / 1453 tests pass
npm run type-check 0 errors
Lefthook pre-commit (dprint, lockfile, version) all green

Closes #175.

monaco-editor 0.55.1 hard-pins dompurify 3.2.7 in its package.json
('dompurify': '3.2.7'). That version has 16+ open advisories
(mutation-XSS, prototype pollution, ADD_TAGS predicate bypass, hook
pollution, IN_PLACE realm confusion, SAFE_FOR_TEMPLATES bypass,
et al.). 'npm audit fix --force' tried to downgrade monaco-editor to
0.53.0 to escape the chain - losing ~6 months of monaco improvements
(HTML rendering, marked 14, accessibility) for a transitive dep we
never invoke at runtime.

SQLPilot doesn't use monaco's diff editor (the only path that
exercises dompurify at runtime in the ESM build Vite consumes).
Override dompurify to ^3.4.11 at the npm level:

  "overrides": { "dompurify": "^3.4.11" }

Vite bundles monaco's ESM build (./esm/vs/editor/editor.main.js),
which imports dompurify as an external module. The override flows
through to the production bundle. The vendored 3.2.7 copy inside
monaco-editor/min/vs/editor.api-*.js (legacy CJS bundle) is not used
in our build path - only relevant if a downstream consumer were to
require() monaco.

What this fixes:
  - DOMPurify XSS chain (GHSA-v2wj-7wpq-c8vv + 15 sibling GHSAs)
  - 'npm audit' on this branch: 0 vulnerabilities (was 2 prod + 3 dev)

What this does NOT touch:
  - cargo audit: already passing via scripts/cargo-audit-check.sh
    design (0 real vulnerabilities, 17 non-blocking
    unmaintained/unsound warnings via gtk-rs + unic-* + glib -
    tracked in #204/#206).
  - KNOWN_ACCEPTED list in cargo-audit-check.sh unchanged
    (still 2 quick-xml DoS awaiting wayland-rs release per #206).
  - 'npm run deps:check' 5 cargo deps-too-new failure: pre-existing
    on main, unrelated to this PR. Same Cargo.lock entries on main
    also fail the gate. Out of scope here.

Closes #175.
@EVWorth

EVWorth commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by PR #224 (.npmrc min-release-age=7 + Dependabot cooldown). The dompurify override in this PR is no longer needed — the supply-chain defense moved to native tooling (npm at-resolver + Dependabot bot-cooldown). Current npm audit: 0 vulnerabilities.

The cargo dep-age gate failure (5 cargo deps <7d old, from #205) is unrelated and tracked in #223.

@EVWorth EVWorth closed this Jul 20, 2026
@EVWorth
EVWorth deleted the fix/175-audit-vulnerabilities branch July 20, 2026 02:55
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.

fix: resolve cargo audit and npm audit vulnerabilities

1 participant