Repository navigation
chore(security): resolve pnpm audit vulnerabilities (2 high) - #454
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe package configuration raises the minimum Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Comment |
Both advisories are in transitive, dev-only dependencies; neither package is a direct dependency of any workspace package. `pnpm audit --prod` was already clean, so only the `audit-all` CI job was red. Following the existing convention, each is remediated by raising (or adding) a `pnpm.overrides` floor plus a lockfile refresh. Override floor raised: - js-yaml >=4.3.0 <5 -> >=4.3.1 <5 (4.3.0 -> 4.3.1) Override added: - nanoid >=3.3.17 <4 (3.3.16 -> 3.3.18) js-yaml (GHSA-5p4m-2wfm-xmqj, quadratic CPU consumption in !!omap resolution) reaches the tree only through packages/cli's json-schema-to-typescript 15.0.4 devDependency, both directly and via @apidevtools/json-schema-ref-parser 11.9.3. Both consumers declare `js-yaml: ^4.1.0`, so the existing `<5` upper bound is kept: `latest` is 5.2.3 and a bare floor would resolve past both consumers' supported range. 4.3.1 is a genuine backport rather than a version bump -- lib/type/omap.js is the only source file changed, replacing the O(n) linear scan of seen keys with an O(1) lookup. The `v4-legacy` dist-tag now points at 4.3.1, so the 4.x line is still security-maintained. nanoid (GHSA-2v37-7h3g-55p8 / CVE-2026-67213, custom generators can loop indefinitely when size is zero) has exactly one consumer, postcss 8.5.23, reached through vite 8.0.16 from vite-tsconfig-paths, vitest and @vitest/coverage-v8. The `<4` bound is load-bearing for two independent reasons: - The advisory covers two ranges, `<3.3.17` and `>=4.0.0 <5.1.6`. The whole 4.x line is affected and never received a patched release, so a `<5` bound would resolve to 4.0.x and reintroduce the advisory. `<4` keeps the resolution inside the patched 3.x line. pnpm audit reports only the first range because that is the one the installed version matched. - pnpm overrides replace the consumer's specifier outright, so a bare `>=3.3.17` floor was measured to resolve nanoid to 6.0.1 -- three majors past postcss's declared `^3.3.16`. nanoid 4+ is ESM-only, but that is not itself a breakage argument here: Node supports require(esm) from 22.12.0 and this repo's engines floor is >=22.14.0, so postcss's `require('nanoid/non-secure')` keeps working. The two reasons above stand on their own. `pnpm audit` and `pnpm audit --prod` both report no known vulnerabilities. Build, typecheck, license-check, lint and the full test suite (2784 tests) pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MH71aBtxrizLCVrWUhSAzj
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
=======================================
Coverage 88.23% 88.23%
=======================================
Files 191 191
Lines 10688 10688
Branches 3077 2993 -84
=======================================
Hits 9431 9431
Misses 1255 1255
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
acd3d8f to
ef47973
Compare
Both advisories are in transitive, dev-only dependencies; neither package is a direct dependency of any workspace package.
pnpm audit --prodwas already clean, so only theaudit-allCI job was red.Following the existing convention (#438, #434), each is remediated by raising (or adding) a
pnpm.overridesfloor plus a lockfile refresh.Changes
js-yaml>=4.3.0 <5→>=4.3.1 <5nanoid>=3.3.17 <4js-yaml — raise existing floor, keep
<5Quadratic CPU consumption in
!!omapresolution. Reaches the tree only throughpackages/cli'sjson-schema-to-typescript@15.0.4devDependency — both directly and via@apidevtools/json-schema-ref-parser@11.9.3. Both consumers declarejs-yaml: ^4.1.0.latestis5.2.3, so the existing<5bound is kept — a bare floor would resolve past both consumers' supported range. This mirrors the reasoning already recorded forjs-yamlandfast-uriin #434 / #438.4.3.1 is a genuine backport rather than a version bump:
lib/type/omap.jsis the only source file changed, replacing the O(n) linear scan of seen keys with an O(1) lookup. Thev4-legacydist-tag now points at 4.3.1, so the 4.x line is still security-maintained.json-schema-to-typescript@15.0.4is alreadylatestand still declares^4.1.0, so there is no direct-dependency bump available as an alternative.nanoid — add new override,
<4is load-bearingCustom generators can loop indefinitely when
sizeis zero. Exactly one consumer:postcss@8.5.23, reached throughvite@8.0.16fromvite-tsconfig-paths,vitestand@vitest/coverage-v8.The
<4bound matters for two independent reasons:1. The advisory covers two ranges. Affected is
< 3.3.17and>= 4.0.0, < 5.1.6— the entire 4.x line is affected and never received a patched release (the fix jumps to 5.1.6). A<5bound would therefore resolve to 4.0.x and reintroduce the advisory.<4keeps resolution inside the patched 3.x line.pnpm auditreports only the first range because that is the one the installed version matched.2. pnpm overrides discard the consumer's specifier. Applying a bare
>=3.3.17and regenerating the lockfile was measured to resolve nanoid to 6.0.1 — three majors past postcss's declared^3.3.16:>=3.3.17 <4resolves to3.3.18. The floor is written as3.3.17(the advisory's stated patched version, per convention);3.3.18only backfills the same guard intoasync/index.native.js.Alternatives considered
json-schema-to-typescriptis alreadylatest.postcssforward instead — viable but rejected.postcsslatestis8.5.26(this repo is pinned at8.5.23), and8.5.26declaresnanoid: ^3.3.17, so the existingpostcss: ">=8.5.18"override would clear this advisory with nopackage.jsonedit at all. The explicitnanoidoverride is preferred because repo convention floors the vulnerable package itself (qs,body-parser,fast-uri,js-yaml,ip-addressall do), and it stays durable if postcss later loosens its range.vite/vite-tsconfig-paths— irrelevant:postcssisvite's own dependency and the edge persists at anyviteversion.Verification
All run locally on this branch:
pnpm auditpnpm audit --prodpnpm run buildpnpm run typecheckpnpm run testpnpm run license-checkpnpm run lintAndFormatTest counts are identical to the pre-change baseline on
main.🤖 Generated with Claude Code
https://claude.ai/code/session_01MH71aBtxrizLCVrWUhSAzj