Skip to content
This repository was archived by the owner on Aug 10, 2026. It is now read-only.

Replace request dependency with native fetch, upgrade mocha to ^11 - #161

Merged
moshen merged 2 commits into
masterfrom
2026-08-09-security-updates
Aug 9, 2026
Merged

Replace request dependency with native fetch, upgrade mocha to ^11#161
moshen merged 2 commits into
masterfrom
2026-08-09-security-updates

Conversation

@moshen

@moshen moshen commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Remove the deprecated 'request' npm dependency (unmaintained, multiple critical/high vulnerabilities: form-data CRLF injection + unsafe random, tough-cookie prototype pollution, qs DoS, uuid buffer overflow, SSRF in request). Replace with a minimal native fetch-based HTTP client (lib/utils/httpRequest.js) that supports the options.callback(err, res, body) contract used by makeRequest and the constructor's mock-request injection point.

Upgrade mocha from ^2.4.5 to ^11.8.0 to eliminate critical/high vulnerabilities in mocha 2.x's transitive deps (growl command injection, minimist prototype pollution, minimatch ReDoS, debug/ms ReDoS). Mocha 11 dropped test/mocha.opts in favor of .mocharc.yml (added). Add npm 'overrides' to force patched versions of serialize-javascript (^7.0.5) and diff (^5.2.0) that mocha 11's tree pulls in transitively.

Update the 'No connection' integration test: fetch surfaces connection errors with err.code on err.cause; the httpRequest client now copies err.cause.code to err.code for compatibility. The test no longer asserts a specific ECONNRESET code (transport-dependent) and instead asserts a connection-error code is present.

Result: npm audit reports 0 vulnerabilities. Unit: 433 passing.
Integration: 39 passing.

moshen added 2 commits August 9, 2026 12:31
Remove the deprecated 'request' npm dependency (unmaintained, multiple
critical/high vulnerabilities: form-data CRLF injection + unsafe random,
tough-cookie prototype pollution, qs DoS, uuid buffer overflow, SSRF in
request). Replace with a minimal native fetch-based HTTP client
(lib/utils/httpRequest.js) that supports the options.callback(err, res,
body) contract used by makeRequest and the constructor's mock-request
injection point.

Upgrade mocha from ^2.4.5 to ^11.8.0 to eliminate critical/high
vulnerabilities in mocha 2.x's transitive deps (growl command injection,
minimist prototype pollution, minimatch ReDoS, debug/ms ReDoS). Mocha
11 dropped test/mocha.opts in favor of .mocharc.yml (added). Add npm
'overrides' to force patched versions of serialize-javascript (^7.0.5)
and diff (^5.2.0) that mocha 11's tree pulls in transitively.

Update the 'No connection' integration test: fetch surfaces connection
errors with err.code on err.cause; the httpRequest client now copies
err.cause.code to err.code for compatibility. The test no longer asserts
a specific ECONNRESET code (transport-dependent) and instead asserts a
connection-error code is present.

Result: npm audit reports 0 vulnerabilities. Unit: 433 passing.
Integration: 39 passing.
Native fetch is only global (no flag) in Node 18+. The package.json
engines field previously claimed >=8.17.0, which would break at runtime
for Node 8-17 users since fetch is not available. Update the engine floor
to match reality. The API contract (constructor mock injection) is
unchanged.
@moshen
moshen merged commit 393be3c into master Aug 9, 2026
6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant