[P1] Upgrade vitest to clear four dev-tooling npm advisories before the 2026-11-30 exception expiry #46

Closed
opened 2026-10-22 18:55:12 +02:00 by amiryahaya · 0 comments
Owner

Outcome and scope

Upgrade the frontend test tooling off the vulnerable vitest 3.2.7 line, remove the four temporary npm exceptions, and keep both frontend gates (type check, 80% line coverage, build) green.

The post-merge security workflow (#45) found four advisories in development tooling. They are accepted in web/audit-exceptions.txt until 2026-11-30. After that date the Security workflow fails on the expired entries, so this has to land first or the exceptions must be re-reviewed with a recorded reason.

Advisory Package Severity
GHSA-82fw-gwwq-j7x9 @vitest/mocker moderate
GHSA-qxg6-89mg-rqv8 @vitest/mocker moderate
GHSA-5gmw-xhrv-c9v3 tinypool critical
GHSA-85c8-ppgw-ccpr tinypool critical

Why it is not urgent, and why it still matters

These packages are development tooling only: npm audit --omit=dev reports nothing, and none of them is in the production bundle. Exploiting them needs attacker-controlled test configuration, mock registrations or worker options. CI runs only this repository's own tests in a throwaway container with no secrets. The risk is to developer machines and CI if a malicious dependency or test file reaches the test runner, so it is a supply-chain hygiene issue, not an exposure of the running system. Two of the advisories are rated critical, which is why the exception is time-limited.

Approach

npm audit offers vitest 5.0.5 as the fix, which it marks as a breaking change. The packages are pinned exactly today (vitest 3.2.7, @vitest/coverage-v8 3.2.7), and @vitest/coverage-v8 must move with vitest.

  1. Read the release notes between 3.2.7 and the fixed version and note breaking changes that touch this repository's config (web/vitest.config.ts, the jsdom setup, coverage settings) and tests.
  2. Upgrade vitest and @vitest/coverage-v8 together, pinned exactly, plus any peer dependencies they now require. Check the supported Node range against .node-version (22.23.2) and the CI image before assuming it fits.
  3. Fix breakage in config and tests only as needed; do not weaken assertions or lower the coverage threshold.
  4. Remove the four entries from web/audit-exceptions.txt (the gate reports an unused exception as a note, so stale entries are visible).

Acceptance criteria

  • npm audit reports no advisories for production or development dependencies, or any that remain are listed in web/audit-exceptions.txt with a new reason and review date.
  • The four GHSA entries above are removed from web/audit-exceptions.txt, and node scripts/audit-npm.mjs passes with no "unused exception" notes for them.
  • npm run typecheck, npm test, npm run test:coverage (at least 80% line coverage) and npm run build pass in web/ on Node 22.23.2.
  • The CI workflow (Rust and Web jobs) and the Security workflow both pass on the pull request or on main after merge.
  • package.json, package-lock.json and the toolchain notes in docs/operations/ci.md are updated together, as that guide requires for tool updates.

Verification

Run the commands in the root README from web/, then node scripts/audit-npm.mjs, node --test scripts/audit-npm.test.mjs, and npm audit (including dev dependencies). Record exact commands and results in the pull request. Check the Actions page for the completed Web and Security runs.

Requirements and references

NFR-MAINT-007 (coverage gates), SRS supply-chain expectations in the decision register (docs/decisions.md); tool-update rule and security workflow in docs/operations/ci.md. Findings were produced by the first run of .forgejo/workflows/security.yml and confirmed locally with npm audit.

Security impact: development tooling only; no change to the production bundle, authorization or data handling. Synthetic fixtures only.

## Outcome and scope Upgrade the frontend test tooling off the vulnerable `vitest` 3.2.7 line, remove the four temporary npm exceptions, and keep both frontend gates (type check, 80% line coverage, build) green. The post-merge security workflow ([#45](https://forgejo.primatekun.tech/primatekuntech/rag-rust/pulls/45)) found four advisories in development tooling. They are accepted in `web/audit-exceptions.txt` **until 2026-11-30**. After that date the Security workflow fails on the expired entries, so this has to land first or the exceptions must be re-reviewed with a recorded reason. | Advisory | Package | Severity | |---|---|---| | GHSA-82fw-gwwq-j7x9 | `@vitest/mocker` | moderate | | GHSA-qxg6-89mg-rqv8 | `@vitest/mocker` | moderate | | GHSA-5gmw-xhrv-c9v3 | `tinypool` | critical | | GHSA-85c8-ppgw-ccpr | `tinypool` | critical | ## Why it is not urgent, and why it still matters These packages are development tooling only: `npm audit --omit=dev` reports nothing, and none of them is in the production bundle. Exploiting them needs attacker-controlled test configuration, mock registrations or worker options. CI runs only this repository's own tests in a throwaway container with no secrets. The risk is to developer machines and CI if a malicious dependency or test file reaches the test runner, so it is a supply-chain hygiene issue, not an exposure of the running system. Two of the advisories are rated critical, which is why the exception is time-limited. ## Approach `npm audit` offers `vitest` 5.0.5 as the fix, which it marks as a breaking change. The packages are pinned exactly today (`vitest` 3.2.7, `@vitest/coverage-v8` 3.2.7), and `@vitest/coverage-v8` must move with `vitest`. 1. Read the release notes between 3.2.7 and the fixed version and note breaking changes that touch this repository's config (`web/vitest.config.ts`, the jsdom setup, coverage settings) and tests. 2. Upgrade `vitest` and `@vitest/coverage-v8` together, pinned exactly, plus any peer dependencies they now require. Check the supported Node range against `.node-version` (22.23.2) and the CI image before assuming it fits. 3. Fix breakage in config and tests only as needed; do not weaken assertions or lower the coverage threshold. 4. Remove the four entries from `web/audit-exceptions.txt` (the gate reports an unused exception as a note, so stale entries are visible). ## Acceptance criteria - [ ] `npm audit` reports no advisories for production or development dependencies, or any that remain are listed in `web/audit-exceptions.txt` with a new reason and review date. - [ ] The four GHSA entries above are removed from `web/audit-exceptions.txt`, and `node scripts/audit-npm.mjs` passes with no "unused exception" notes for them. - [ ] `npm run typecheck`, `npm test`, `npm run test:coverage` (at least 80% line coverage) and `npm run build` pass in `web/` on Node 22.23.2. - [ ] The CI workflow (Rust and Web jobs) and the Security workflow both pass on the pull request or on `main` after merge. - [ ] `package.json`, `package-lock.json` and the toolchain notes in `docs/operations/ci.md` are updated together, as that guide requires for tool updates. ## Verification Run the commands in the root README from `web/`, then `node scripts/audit-npm.mjs`, `node --test scripts/audit-npm.test.mjs`, and `npm audit` (including dev dependencies). Record exact commands and results in the pull request. Check the Actions page for the completed Web and Security runs. ## Requirements and references NFR-MAINT-007 (coverage gates), SRS supply-chain expectations in the decision register ([`docs/decisions.md`](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/decisions.md)); tool-update rule and security workflow in [`docs/operations/ci.md`](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/operations/ci.md). Findings were produced by the first run of `.forgejo/workflows/security.yml` and confirmed locally with `npm audit`. **Security impact:** development tooling only; no change to the production bundle, authorization or data handling. Synthetic fixtures only.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/rag-rust#46
No description provided.