Skip to content

Resolve all open Dependabot alerts in the dev dependency tree - #154

Open
jessicahearn wants to merge 1 commit into
mainfrom
fix/dependabot-alerts
Open

Resolve all open Dependabot alerts in the dev dependency tree#154
jessicahearn wants to merge 1 commit into
mainfrom
fix/dependabot-alerts

Conversation

@jessicahearn

Copy link
Copy Markdown
Contributor

Closes all 9 open Dependabot alerts (5 high, 3 medium, 1 low). npm audit now reports 0 vulnerabilities, down from 22.

Every alert was a transitive dependency of a dev dependency — the one exception being a low-severity formidable alert reaching in through superagent. No shipped library code is affected.

Why this wasn't just a lockfile refresh

mocha@10.2.0 pinned three of the vulnerable packages at exact versions — js-yaml 4.1.0, minimatch 5.0.1, serialize-javascript 6.0.0 — so no amount of lock refreshing could move them. And even the newest mocha@11.8.0 requires serialize-javascript ^6.0.2, while the high-severity RCE advisory is only patched in 7.0.3. So this needed a mocha major bump plus an override.

Separately, npm install on its own kept every locked version that still satisfied its range even after deleting node_modules — an explicit npm update was required to pull the in-range patches for js-yaml 3.x, minimatch 3.x, formidable, and qs.

Changes

package.json

Change Reason
mocha^11.8.0 Replaces the exact pins with ranges; drops the chokidar 3 (braces) and glob 7 subtrees entirely
nyc^18.0.0 istanbul-lib-processinfo@3.0.1 drops uuid as a dependency altogether
pre-commit^2.0.0 Moves cross-spawn 5.1.0 → ^7, clearing a high-severity ReDoS
Remove dependency-lint Referenced by no npm script and no CI step; carried an unmaintained js-yaml 3.x / minimatch 3.x / glob 7 subtree
New overrides serialize-javascript: ^7.0.5 (RCE + DoS), diff: ^8.0.3 (jsdiff parsePatch/applyPatch DoS)
Pin the eight "" devDeps See below

The eight devDependencies declared as "" meant "any version". Left unpinned, regenerating the lock silently jumps chai from 4 to 6 — which is ESM-only and breaks every require('chai').expect in test/chartmogul/. They are now pinned to their current majors.

.github/workflows/test.yml — matrix [16, 18, 20, '*'][20, 22, '*'], since mocha@11 requires node >=18.18 and serialize-javascript@7.0.5 declares >=20. Also bumps actions/checkout and actions/setup-node from the deprecated @v2 runtimes to @v4.

The library's own engines: { node: ">=16" } is deliberately unchanged — devDependencies are never installed for consumers, so node 16 users are unaffected. This raises the floor for contributors only.

package-lock.json — npm rewrote lockfileVersion 2 → 3, hence the large diff (~2,700 net lines removed). Node 20 ships npm 10, so this reads fine across the new matrix. Also folds in the 3.7.13.8.0 version sync that #120 missed in the lock.

Verification

  • 195 tests passing on mocha 11
  • npm run cover under nyc 18 still writes coverage/lcov.info
  • npm run lint clean, no source files modified
  • npm audit → 0 vulnerabilities. braces, uuid, and dependency-lint gone from the tree; serialize-javascript 7.1.0, js-yaml 3.15.1 + 4.3.1, minimatch 3.1.5/9.0.9, cross-spawn 7.0.6 only
  • pre-commit hook reinstalled and firing (it ran lint + tests on this commit)

No release needed — only devDependencies and the lock file changed. The published package contents and its runtime dependency ranges are untouched.

🤖 Generated with Claude Code

All 9 open alerts are transitive dependencies of dev dependencies, the one
exception being a low-severity formidable alert via superagent. npm audit
goes from 5 findings to 0.

The existing overrides were each one patch short of the current advisories
(js-yaml pinned to 3.15.0 where the fix is 3.15.1, and to 4.3.0 where the
fix is 4.3.1), which is why the alerts stayed open. Pinning override targets
to exact versions goes stale every time an advisory is extended, so this
refreshes the lock instead and keeps overrides only where a range genuinely
cannot reach the fix:

- mocha -> ^11.8.0. mocha 10.2.0 pinned js-yaml, minimatch and
  serialize-javascript at exact versions, so no lock refresh could move
  them. mocha 11 uses ranges, and drops the chokidar 3 (braces) and glob 7
  subtrees entirely.
- serialize-javascript override ^7.0.5: even mocha 11 asks for ^6.0.2 while
  the RCE advisory is only patched in 7.0.3 and the DoS in 7.0.5. mocha is
  the sole consumer and uses it only on the parallel-worker path, which
  .mocharc.json does not enable.
- diff override ^8.0.3 for the jsdiff parsePatch/applyPatch DoS.
- Drop the js-yaml and brace-expansion overrides. With the lock refreshed
  these resolve to 3.15.1 / 4.3.1 and 1.1.18 / 2.1.4 inside their existing
  caret ranges, so the pins are no longer load-bearing.
- pre-commit -> ^2.0.0, moving cross-spawn 5.1.0 -> ^7 and clearing a high
  severity ReDoS.
- Remove dependency-lint: referenced by no npm script and no CI step, and
  carried an unmaintained js-yaml 3.x / minimatch 3.x / glob 7 subtree.
- Pin the eight devDeps declared as "" (= any version). Left unpinned, a
  lock regeneration pulls chai 4 -> 6, which is ESM-only and breaks every
  require('chai') in the test suite.

CI drops node 18, as serialize-javascript 7.0.5 declares >=20 and mocha 11
needs >=18.18. The library's own engines: { node: ">=16" } is unchanged --
devDependencies are never installed for consumers, so this raises the floor
for contributors only.

249 tests pass, coverage still writes coverage/lcov.info, lint is clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jessicahearn
jessicahearn force-pushed the fix/dependabot-alerts branch from 1eff45d to d65fb3c Compare August 14, 2026 14:15
@socket-security

Copy link
Copy Markdown

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @noble/hashes is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/superagent@8.1.2npm/@noble/hashes@1.8.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@noble/hashes@1.8.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @noble/hashes is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/superagent@8.1.2npm/@noble/hashes@1.8.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@noble/hashes@1.8.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm yargs is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/mocha@11.8.0npm/yargs@17.7.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/yargs@17.7.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

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