chore(deps): upgrade vulnerable dependencies and re-enable strict CVE gating#30
Conversation
… gating (closes #14)
There was a problem hiding this comment.
Code Review
This pull request updates several dependencies and introduces an overrides block in package.json to pin versions for security. However, the review highlights that many of the specified versions, including next@15.5.18 and several packages in the overrides block, do not exist on the public npm registry, which poses a critical security risk and will cause build failures. Additionally, the reviewer noted that manual modifications to the pnpm-lock.yaml for fdir are discouraged and should be handled via overrides instead.
| "overrides": { | ||
| "handlebars": ">=4.7.9", | ||
| "minimatch": ">=10.2.3", | ||
| "multer": ">=2.1.1", | ||
| "lodash": ">=4.18.0", | ||
| "path-to-regexp": ">=8.4.0", | ||
| "serialize-javascript": ">=7.0.3", | ||
| "flatted": ">=3.4.2", | ||
| "picomatch": ">=4.0.4", | ||
| "fast-uri": ">=3.1.2", | ||
| "@babel/plugin-transform-modules-systemjs": ">=7.29.4" | ||
| } |
There was a problem hiding this comment.
Several dependency versions specified in this overrides block do not appear to exist on the public npm registry. For example:
lodash@4.18.1(Latest stable is4.17.21)handlebars@4.7.9(Latest stable is4.7.8)multer@2.1.1(Latest stable is1.4.5-lts.1)@babel/plugin-transform-modules-systemjs@7.29.4(Latest is7.26.9)
Using non-standard or non-existent versions is a critical security risk (potential dependency confusion or supply chain attack) and will cause build failures in standard environments. Please verify these versions and ensure they are sourced from a trusted, reachable registry.
| "lucide-react": "^0.575.0", | ||
| "motion": "^12.34.3", | ||
| "next": "^15.2.0", | ||
| "next": "^15.5.18", |
There was a problem hiding this comment.
| engines: {node: '>=12.0.0'} | ||
| peerDependencies: | ||
| picomatch: ^3 || ^4 | ||
| picomatch: '>=4.0.4' |
There was a problem hiding this comment.
The peerDependencies for fdir@6.5.0 have been manually modified in the lockfile from ^3 || ^4 to '>=4.0.4'. Manually editing package metadata in the lockfile is highly discouraged as it will likely be overwritten during the next clean pnpm install or lockfile regeneration. If you need to enforce a specific version of a transitive dependency, it should be handled exclusively via the overrides in the root package.json.
Summary
Drives the open dependency-CVE list from 1 CRITICAL + 35 HIGH down to 0 high/critical, then re-tightens the security CI gates that PR #17 had landed in advisory mode.
Change
Dependency upgrades
apps/web/package.json—next^15.2.0 → ^15.5.18 (multiple GHSAs).package.jsonpnpm.overrides— pin transitive deps to their patched ranges. Each entry maps to an open advisory:handlebars >= 4.7.9— prototype pollution + RCE chain (storybook → babel preset)minimatch >= 10.2.3— ReDoS (multiple roots)multer >= 2.1.1— DoS via malformed bodylodash >= 4.18.0— prototype pollutionpath-to-regexp >= 8.4.0— backtracking ReDoSserialize-javascript >= 7.0.3— XSS via crafted regexflatted >= 3.4.2— prototype pollutionpicomatch >= 4.0.4— ReDoSfast-uri >= 3.1.2— path traversal + host confusion (nestjs CLI → ajv chain)@babel/plugin-transform-modules-systemjs >= 7.29.4— arbitrary-code generation (storybook → preset-env chain)pnpm installre-pinned the lockfile against these overrides.CI gating re-enabled
.github/workflows/dependency-audit.yml— strip|| truefrom the audit step so the job fails on any high/critical..github/workflows/container-scan.yml— flip Trivyexit-codefrom'0'(advisory) back to'1'(fail-the-build).ignore-unfixed: truestays so the gate only fails on advisories that have an available patch — otherwise we'd be perma-red on Alpine base-image CVEs we can't fix.Audit deltas
Before this PR (advisory mode tolerated):
```
68 vulnerabilities found
Severity: 7 low | 25 moderate | 35 high | 1 critical
```
After:
```
12 vulnerabilities found
Severity: 4 low | 8 moderate
```
Zero high/critical remaining. The 12 low/moderate are transitives in dev-only paths (storybook, eslint plugins) with no patched versions yet; the strict gate ignores them.
Test plan
pnpm installreconciles the lockfile against the new overrides cleanlypnpm audit --audit-level=high→ 0 findingspnpm --filter @contractor-os/api test(362 tests) greenpnpm --filter @contractor-os/web test(26 tests) greenpnpm build(all packages) greenCloses #14