Skip to content

chore(deps): pin dompurify, js-yaml, postcss-selector-parser in starlight-docs - #361

Merged
kylehounslow merged 2 commits into
opensearch-project:mainfrom
kylehounslow:security/starlight-docs-cves-357
Jul 28, 2026
Merged

chore(deps): pin dompurify, js-yaml, postcss-selector-parser in starlight-docs#361
kylehounslow merged 2 commits into
opensearch-project:mainfrom
kylehounslow:security/starlight-docs-cves-357

Conversation

@kylehounslow

Copy link
Copy Markdown
Collaborator

What

Pins three vulnerable transitive dependencies in the docs/starlight-docs lockfile via package.json overrides. All three bumps stay within their existing majors.

Package From To Advisory Severity Pulled in by
dompurify 3.4.5 3.4.12 CVE-2026-49978 (+8 more) 9.3 CRITICAL mermaid
js-yaml 4.1.1 4.3.0 CVE-2026-59869, CVE-2026-53550 7.5 HIGH @astrojs/starlight
postcss-selector-parser 6.1.2 6.1.4 CVE-2026-9358 4.3 MEDIUM postcss-nested

Source alert: #357 (starlight-docs section). Tracking alerts: #258 (mermaid: dompurify, 9 CVEs, highest 9.3) and #278 (starlight: js-yaml + postcss-selector-parser, highest 7.5).

Why overrides

dompurify and js-yaml resolve one lockfile refresh away from their patched versions, but postcss-selector-parser is a transitive dep of postcss-nested (^6.1.1); npm install --package-lock-only alone keeps it pinned at 6.1.2. An explicit overrides entry is required to move it. Per the CVE-2026-9358 advisory the fix was backported to the 6.x line in 6.1.3, so ^6.1.3 (resolving to 6.1.4) clears it without a major bump. The other two are placed in the same overrides block so the intended floor is auditable in the manifest, not only in the lockfile.

The astro-7 / starlight-0.41 supersets (#336, #356) are intentionally excluded; the astro v7 evaluation is tracked separately (#340, #327).

Validation

Mirrors docs-ci.yml, Node 22:

  • npm ci && npm run build (starlight): green, 135 pages, all internal links valid.
  • Mermaid render check: 63 built pages carry <pre class="mermaid">, and the bundled dist/_astro/mermaid.core.*.js ships DOMPurify 3.4.12. dompurify is mermaid's XSS sanitizer, so this confirms the patched sanitizer reaches the built output, not just the lockfile.
  • npm audit --omit=dev: dompurify, js-yaml, and postcss-selector-parser all clear. Remaining audit entries (astro, esbuild, postcss, sharp, svgo, vite) are out of scope for this alert.
  • npm ls dompurify js-yaml postcss-selector-parser: all three report overridden at the patched versions.

Closes #258, closes #278

…ight-docs

Clears CVEs in the docs/starlight-docs lockfile via package.json overrides,
all within existing majors:

- dompurify 3.4.5 -> 3.4.12  (CVE-2026-49978 CRITICAL 9.3, +8 more, via mermaid)
- js-yaml 4.1.1 -> 4.3.0     (CVE-2026-59869 7.5, CVE-2026-53550 5.3, via @astrojs/starlight)
- postcss-selector-parser 6.1.2 -> 6.1.4  (CVE-2026-9358 4.3, via postcss-nested)

postcss-selector-parser is a transitive dep of postcss-nested (^6.1.1); a
lockfile refresh alone keeps it at 6.1.2, so it needs an explicit override.
CVE-2026-9358's fix was backported to 6.1.3, so ^6.1.3 clears it.

Closes opensearch-project#258, closes opensearch-project#278

Signed-off-by: Kyle Hounslow <kylehounslow@users.noreply.github.com>
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.62%. Comparing base (782b129) to head (65f2f23).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #361   +/-   ##
=======================================
  Coverage   55.62%   55.62%           
=======================================
  Files           4        4           
  Lines         169      169           
  Branches       47       47           
=======================================
  Hits           94       94           
  Misses         74       74           
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread docs/starlight-docs/package.json Outdated
Comment on lines +21 to +22
"dompurify": "3.4.12",
"js-yaml": "4.3.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"dompurify": "3.4.12",
"js-yaml": "4.3.0",
"dompurify": "^3.4.12",
"js-yaml": "^4.3.0",

no need to lock to the patch version?

I also still don't understand why lockfile is needed, they are all within the same major version. You can try running

npm audit fix

if there is a dependency that's not flagged for cve in npm audit, you can update to latest patch using npm update xxx

it's generally better to avoid package.json changes unless necessary to keep things clean

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@joshuali925 Good call. Removed overrides!

The dompurify/js-yaml/postcss-selector-parser overrides are unnecessary:
the parent ranges (mermaid dompurify ^3.3.1, starlight/astro js-yaml ^4.1.1,
postcss-nested postcss-selector-parser ^6.1.1) already span the patched
versions, so the lockfile pins 3.4.12 / 4.3.0 / 6.1.4 on its own.

Regenerating with the block removed produces a byte-identical lockfile
(0 version changes); npm ci + build stay green, links valid, all three
CVEs remain cleared.

Signed-off-by: Kyle Hounslow <kylehounslow@users.noreply.github.com>
@kylehounslow
kylehounslow merged commit 0176d3a into opensearch-project:main Jul 28, 2026
8 checks passed
@kylehounslow
kylehounslow deleted the security/starlight-docs-cves-357 branch July 28, 2026 18:08
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.

starlight-0.38.5.tgz: 3 vulnerabilities (highest severity is: 7.5) mermaid-11.15.0.tgz: 9 vulnerabilities (highest severity is: 9.3)

2 participants