fix(deps): patch remaining npm security vulnerabilities via react-router v7 and overrides - #382
Merged
Conversation
…ter v7 and overrides Bumps react-router-dom 6.30.4 -> 7.18.2 and adds/updates overrides for brace-expansion, svgo, shell-quote, fast-uri, http-proxy-middleware, body-parser, @babel/core, and postcss, closing 13 of the 16 open Dependabot alerts (the remaining 3, webpack-dev-server, have no compatible patch under react-scripts 5.0.1 and are handled via dismissal, not a code change). Adds src/setupTests.js (TextEncoder/TextDecoder polyfill) and a jest moduleNameMapper for react-router's ./dom export, both required for CRA 5's frozen Jest 27 to resolve react-router v7's package exports. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133KzW3jzNgtEkcbKZmytyC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
react-router-dom6.30.4 → 7.18.2 and adds/updates npmoverridesforbrace-expansion,svgo,shell-quote,fast-uri,http-proxy-middleware,body-parser,@babel/core, andpostcss.webpack-dev-server, alerts 35/44/45) have no compatible patch underreact-scripts5.0.1 and will be dismissed asnot_usedseparately (build-time-only, prod serves a static build viaserve).frontend/src/setupTests.js(TextEncoder/TextDecoder polyfill) and ajest.moduleNameMapperentry for react-router's./domsubpath export — both required for CRA 5's frozen Jest 27 to resolve react-router v7's package structure. Confirmed by reproducing the failure and fixing it, not assumed.Alert → fix mapping
Each row above was checked against the actual installed version in
package-lock.json, not inferred fromnpm audit's summary.A note on
npm audit's 53-vulnerability countnpm auditreports 53 high-severity findings on this branch. This is a verified reporting artifact, not a regression:brace-expansionadvisories were published this week (GHSA-3jxr-9vmj-r5cp on 2026-07-20, GHSA-mh99-v99m-4gvg on 2026-07-24) extending coverage up to<=5.0.7. Neither is among the 16 target alerts.brace-expansionis pinned via an override,npm auditcan no longer propose a simple version bump as the fix, so it falls back to listing every ancestor in theeslint/jest/workboxdependency chains (all build-time-only, never shipped) instead of one line item."brace-expansion@1": "^1.1.16") so only the 1.x instance (used byminimatch@3.1.5, itself only used by eslint/jest/workbox at build time) is touched — thefilelistpackage'sminimatch@5.1.9still gets its own compatiblebrace-expansion@2.x. Verified vianpm ls brace-expansion.<=5.0.7) would require forcingbrace-expansion@5.xontominimatch@3.1.5, a package frozen insidereact-scriptssince 2022 — real compatibility risk, not required by any of the 16 target alerts, and out of scope here.New advisory found during this work (not yet a Dependabot alert on this repo)
npm auditalso flagsreact-router-dom@7.18.2against GHSA-qwww-vcr4-c8h2 ("RSC Mode CSRF Bypass"), published 2026-07-24 — 6 days before this branch. Read the advisory text directly: it only affects apps using the unstable RSC APIs. Lenny uses none (BrowserRouter/Routes/Route/Link/NavLink/Navigate, no RSC). Staying at 7.18.2 is correct; escaping this advisory would require react-router v8 (a major bump — alerts 51/52 require ≥7.18.0, so every 7.x that closes them sits inside this advisory's range; 8.0+ is the only version outside it). GitHub's own Dependabot scan hasn't picked this up yet — it plausibly will shortly after this merges. Flagging now so a future alert here isn't a surprise.Verification
ruff check+ruff format --check— clean (unchanged from main, no backend code touched).npm run build: compiles successfully, including the SVG-import svgo probe (temporarily wired a real SVG import through@svgr/plugin-svgo— the one path the flatsvgooverride could have silently broken — confirmed clean, then removed the scratch files).npm test -- --watchAll=false: all 6 suites, 88/88 tests pass (required the two jest fixes above; failed without them — this is the one thing CI itself never runs, so it needed this level of scrutiny).npm start: dev server compiles and serves (confirmswebpack-dev-server4.x +shell-quote/http-proxy-middleware/body-parseroverrides didn't break the dev server)./→ redirects to/measures;/measures,/jobs,/results,/validation,/settingsall load with zero console errors.Calculatelink on a measure row — confirmed theLink to={/jobs?newCalc=...}query-param navigation fromMeasuresPage.jsworks correctly with react-router v7./results/1(useParamsroute) and confirmed patient-level results render correctly.npm audit: 13/16 target alerts confirmed closed by direct version check (see table above); the artifact-count caveat is documented above rather than glossed over.Pre-existing bug found during this work (out of scope, filed separately)
While walking every route,
/groupsreturned a raw server 404 on direct navigation. Root cause:frontend/public/serve.json'srewriteslist has an entry for every other client route (/measures,/jobs,/results,/results/:jobId,/validation,/settings) but is missing/groups— unrelated to this PR, predates it, and would behave identically on react-router v6. No nav link currently exposes/groups, so blast radius is low. Filed as a separate issue rather than fixed here to keep this PR scoped to the security patch.Related issue
N/A — see the separate issue filed for the
/groupsfinding above.Type of change
Checklist
docs/decisions.mdTest plan
cd frontend && npm ci && npm run build && npm test -- --watchAll=falsecd backend && ruff check app/ tests/ && python3 -m pytest tests/ --ignore=tests/integration./scripts/run-integration-tests.sh --ignore=tests/integration/test_golden_measures.py --ignore=tests/integration/test_connectathon_measures.py --ignore=tests/integration/test_full_workflow.py --ignore=tests/integration/test_groups_dropdown.py --ignore=tests/integration/test_full_jobs_pipeline.py --ignore=tests/integration/test_factory_reset.pydocker compose up -d --build, then walk/measures→ click Calculate → run a measure calc → view/results/:jobId, and/validation→ upload a bundle → run a validation.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com