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
Conversation
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.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.