Skip to content

chore(security): resolve pnpm audit vulnerabilities (2 high) - #454

Merged
tkislan merged 2 commits into
mainfrom
chore/security-audit-2026-08-11
Aug 11, 2026
Merged

tkislan merged 2 commits into
mainfrom
chore/security-audit-2026-08-11

Conversation

@tkislan

@tkislan tkislan commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

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 (#438, #434), each is remediated by raising (or adding) a pnpm.overrides floor plus a lockfile refresh.

Changes

-      "js-yaml": ">=4.3.0 <5",
+      "js-yaml": ">=4.3.1 <5",
       "lodash": ">=4.18.0",
       "lodash-es": ">=4.18.0",
       "minimatch": ">=10.2.3",
+      "nanoid": ">=3.3.17 <4",
Package Advisory Override Resolved
js-yaml GHSA-5p4m-2wfm-xmqj >=4.3.0 <5 → >=4.3.1 <5 4.3.0 → 4.3.1
nanoid GHSA-2v37-7h3g-55p8 added >=3.3.17 <4 3.3.16 → 3.3.18

js-yaml — raise existing floor, keep <5

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.

latest is 5.2.3, so the existing <5 bound is kept — a bare floor would resolve past both consumers' supported range. This mirrors the reasoning already recorded for js-yaml and fast-uri in #434 / #438.

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.

json-schema-to-typescript@15.0.4 is already latest and still declares ^4.1.0, so there is no direct-dependency bump available as an alternative.

nanoid — add new override, <4 is load-bearing

Custom generators can loop indefinitely when size is zero. 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 matters for two independent reasons:

1. The advisory covers two ranges. Affected is < 3.3.17 and >= 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 <5 bound would therefore resolve to 4.0.x and reintroduce the advisory. <4 keeps resolution inside the patched 3.x line. pnpm audit reports 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.17 and regenerating the lockfile was measured to resolve nanoid to 6.0.1 — three majors past postcss's declared ^3.3.16:

=== resolved nanoid under BARE >=3.3.17 ===
2456:  nanoid@6.0.1:
5208:  nanoid@6.0.1: {}

>=3.3.17 <4 resolves to 3.3.18. The floor is written as 3.3.17 (the advisory's stated patched version, per convention); 3.3.18 only backfills the same guard into async/index.native.js.

Not an argument for the bound: nanoid 4+ being ESM-only. 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 against an ESM-only nanoid — verified directly on Node 22.21.0. Noting it so nobody re-derives a breakage that isn't there. The two reasons above stand on their own.

Alternatives considered

  • Bump a direct dependency — not available: neither package is a direct dependency anywhere, and json-schema-to-typescript is already latest.
  • Refresh the lockfile to carry postcss forward instead — viable but rejected. postcss latest is 8.5.26 (this repo is pinned at 8.5.23), and 8.5.26 declares nanoid: ^3.3.17, so the existing postcss: ">=8.5.18" override would clear this advisory with no package.json edit at all. The explicit nanoid override is preferred because repo convention floors the vulnerable package itself (qs, body-parser, fast-uri, js-yaml, ip-address all do), and it stays durable if postcss later loosens its range.
  • Bump vite / vite-tsconfig-paths — irrelevant: postcss is vite's own dependency and the edge persists at any vite version.

Verification

All run locally on this branch:

Check Result
pnpm audit No known vulnerabilities (exit 0)
pnpm audit --prod No known vulnerabilities (exit 0)
pnpm run build exit 0
pnpm run typecheck exit 0
pnpm run test 2784 passed, 1 skipped (exit 0)
pnpm run license-check exit 0
pnpm run lintAndFormat exit 0

Test counts are identical to the pre-change baseline on main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MH71aBtxrizLCVrWUhSAzj

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f19407b8-ad1b-43f2-b74a-7ca1df158ef5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The package configuration raises the minimum js-yaml override from 4.3.0 to 4.3.1 and adds a nanoid override for versions >=3.3.17 <4.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: jamesbhobbs

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Updates Docs ✅ Passed The PR only updates pnpm overrides and the lockfile for transitive dev dependencies; it adds no user-facing feature or public API that requires documentation.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the dependency security updates that resolve two high-severity pnpm audit vulnerabilities.

Comment @coderabbitai help to get the list of available commands.

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

codecov Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.23%. Comparing base (4fa7374) to head (2c76576).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tkislan
tkislan force-pushed the chore/security-audit-2026-08-11 branch from acd3d8f to ef47973 Compare August 11, 2026 13:00
@tkislan
tkislan marked this pull request as ready for review August 11, 2026 14:08
@tkislan
tkislan requested a review from a team as a code owner August 11, 2026 14:08
@tkislan
tkislan merged commit 847ddc4 into main Aug 11, 2026
21 checks passed
@tkislan
tkislan deleted the chore/security-audit-2026-08-11 branch August 11, 2026 15:11
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