Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove isomorphic-fetch due to vulnerabilities #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rjimenezda
Copy link

@rjimenezda rjimenezda commented Jan 29, 2025

Hi!

We're in the process of removing a bunch of dependabot vulnerabilities in our project because of an upcoming audit, and have encountered that the latest version of logrocket-cli depends on isomorphic-fetch, which depends on a vulnerable version of node-fetch.

This PR drops isomorphic fetch in favour of using node-fetch directly. Node-fetch v1 is still in the lockfile, due to mock-fetch, but it's a devDependency, so it would not affect LogRocket's clients.

I'll leave some comments in the PR itself

@@ -25,7 +25,7 @@
"dependencies": {
"babel-runtime": "^6.20.0",
"glob": "^7.1.1",
"isomorphic-fetch": "^2.1.1",
"node-fetch": "^2.7.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v3 version requires ESM, but this one should be fine security-wise.

Comment on lines +4 to +10
if (!global.fetch) {
global.fetch = module.exports;
global.Response = nodeFetch.Response;
global.Headers = nodeFetch.Headers;
global.Request = nodeFetch.Request;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just what isomorphic-fetch does on commonjs. Perhaps it could be hidden somehow, it feels kind of nasty out here.

Alternatively, the fetch implementation could be injected from outside, but it was overall a bigger change code and architecture-wise.

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