Skip to content

chore(deps): Remove unused dependencies and update vulnerable ones - #13

Merged
renato-freis merged 1 commit into
mainfrom
chore/remove-unused-and-vulnerable-deps
Aug 20, 2026
Merged

chore(deps): Remove unused dependencies and update vulnerable ones#13
renato-freis merged 1 commit into
mainfrom
chore/remove-unused-and-vulnerable-deps

Conversation

@renato-freis

Copy link
Copy Markdown
Contributor

Summary

Closes the Dependabot alerts on main: 19 alerts, 2 of them critical.

Most came from dependencies the code never used, so they are removed rather than bumped. An unused dependency is attack surface with no benefit, and updating one only defers the question to the next advisory.

Infrastructure: 16 vulnerabilities (2 critical) to 0

The package had no test files at all, yet carried vitest and @vitest/coverage-v8. Those held both critical advisories (Vitest UI server arbitrary file read and execute) and pulled a vulnerable vite. CI never ran the infrastructure test script, so removing it changes no pipeline behavior.

It also declared dependencies that are never imported:

Removed Why
@vitest/coverage-v8, vitest no test files; source of both criticals
@aws-sdk/client-cloudwatch-logs, @aws-sdk/client-dynamodb, @aws-sdk/lib-dynamodb not imported; the Lambdas are Python
fast-xml-parser not imported
scte35 not imported
fast-check no property tests here
husky, lint-staged no .husky directory, hooks never installed

The scte35 entry was the least obvious. The only matches in the CDK sources are the name of the Python Lambda layer:

lib/stacks/api-stack.ts:159:  const scte35Layer = buildPythonLayer(
lib/stacks/api-stack.ts:162:    path.join(__dirname, '../../../backend/layers/scte35'),

No import ... from 'scte35' exists, and that unused entry was what pulled inquirer and the vulnerable tmp.

What remains: source-map-support, which bin/pois-reference-server.ts registers, plus the CDK, TypeScript, ESLint and Prettier toolchain.

Frontend: 14 vulnerabilities to 2

scte35 is genuinely used by the SCTE-35 decoder, so it moves to 0.7.0, which replaces the transitive inquirer carrying the tmp path traversal. Verified against real payloads that every field the decoder reads is unchanged:

time_signal + descriptor: spliceCommandType=6, descriptors[0].segmentationTypeId=53
splice_insert:            spliceCommandType=5, spliceEventId/outOfNetworkIndicator/durationFlag present

Toolchain updates shared with infrastructure: @typescript-eslint 6 to 8, clearing five high advisories plus minimatch, and vite 5 to 8 with @vitejs/plugin-react 6, clearing the vite path traversal and the esbuild dev-server advisory. Node requirements of vite 8 (^20.19.0 || >=22.12.0) are satisfied by the repo's Node 20 baseline and by CI.

The stricter no-unused-vars default in @typescript-eslint 8 flagged two unused catch bindings in authSlice.ts; they are now optional catch bindings, which is what the code meant.

Deliberately not included

Two moderate advisories remain, both in react-router. The only fix is react-router-dom 7, a major upgrade of a runtime dependency, which deserves its own PR with a smoke test against a deployment rather than riding along in a dependency cleanup.

Neither advisory applies to this application as written:

  • Arbitrary constructor injection via deserializeErrors() in SSR hydration: this is a client-only SPA with no SSR.
  • Open redirect via backslash in <Link> and useNavigate: navigation targets are static internal routes, never user-controlled input.

Testing

  • infrastructure: npm run lint, npm run build, npx cdk synth (all five stacks)
  • frontend: npx tsc --noEmit, npm run lint, npm run build
  • scte35 0.7.0 exercised against two real base64 payloads
  • backend untouched, suite remains at 190 passing
  • npm audit: infrastructure 0, frontend 2 moderate (react-router only)

The repository reported 19 Dependabot alerts, 2 of them critical. Most came
from dependencies the code never used, so they are removed rather than updated:
an unused dependency is attack surface with no benefit, and updating one only
defers the question.

Infrastructure had no test files, yet carried vitest and @vitest/coverage-v8,
which held both critical advisories and pulled a vulnerable vite. It also
declared the AWS SDK clients, fast-xml-parser, fast-check, husky, lint-staged
and the scte35 npm package without importing any of them. The scte35 entry was
the least obvious: the only matches in the CDK sources are the name of the
Python Lambda layer, not an import. Removing all of it takes the package from
16 vulnerabilities, including the 2 critical, to zero. CI never ran the
infrastructure test script, so dropping it changes no pipeline behavior.

Frontend genuinely uses scte35 for the SCTE-35 decoder, so it moves to 0.7.0,
which replaces the transitive inquirer that carried the tmp path traversal.
Verified against real payloads that the fields the decoder reads are unchanged:
spliceCommandType, the splice_insert and time_signal command shapes, and the
segmentation descriptor values.

Also updates the shared toolchain: @typescript-eslint 6 to 8, which clears five
high advisories plus minimatch, and vite 5 to 8, which clears the vite path
traversal and the esbuild dev-server advisory. The stricter default in
@typescript-eslint 8 flagged two unused catch bindings, now written as optional
catch bindings.

Frontend goes from 14 vulnerabilities to 2, both moderate, in react-router.
Those are left for a separate change: the only fix is react-router-dom 7, a
major upgrade of a runtime dependency that deserves its own review and a smoke
test against a deployment. Neither advisory applies to this app as written,
since it performs no SSR hydration and navigates only to static internal
routes.

Verified: infrastructure lint, build and cdk synth; frontend tsc, lint and
build; and the backend suite is untouched at 190 passing.
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.

1 participant