Fixed prototype pollution vulnerability (issue #7538) in axios's parseHe#10550
Draft
nmurrell07 wants to merge 2 commits intoaxios:v1.xfrom
Draft
Fixed prototype pollution vulnerability (issue #7538) in axios's parseHe#10550nmurrell07 wants to merge 2 commits intoaxios:v1.xfrom
nmurrell07 wants to merge 2 commits intoaxios:v1.xfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 4/5
- This PR is likely safe to merge, with minimal risk: the only noted issue is dependency hygiene rather than a direct functional regression.
- In
package.json, addingjsdomas a production dependency without clear runtime need can increase install size and attack surface for downstream consumers. - Given the moderate severity (5/10) and high confidence (8/10), this is worth correcting soon but does not appear merge-blocking by itself.
- Pay close attention to
package.json- verify whetherjsdomshould be moved to devDependencies or removed if unused at runtime.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="package.json">
<violation number="1" location="package.json:154">
P2: `jsdom` was added as a production dependency without evidence of runtime usage, causing unnecessary installation and attack-surface increase for all consumers.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| "dependencies": { | ||
| "follow-redirects": "^1.15.11", | ||
| "form-data": "^4.0.5", | ||
| "jsdom": "^29.0.1", |
Contributor
There was a problem hiding this comment.
P2: jsdom was added as a production dependency without evidence of runtime usage, causing unnecessary installation and attack-surface increase for all consumers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 154:
<comment>`jsdom` was added as a production dependency without evidence of runtime usage, causing unnecessary installation and attack-surface increase for all consumers.</comment>
<file context>
@@ -151,6 +151,7 @@
"dependencies": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
+ "jsdom": "^29.0.1",
"proxy-from-env": "^2.1.0"
},
</file context>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #7306
Fixed prototype pollution vulnerability (issue #7538) in axios's parseHeaders.js by changing
parsed = {}toparsed = Object.create(null)to prevent proto/constructor attacks. The fix is committed on branch fix/prototype-pollution-parseHeaders and ready for PR submission.Summary by cubic
Prevents prototype pollution in header parsing by switching to a prototype-less headers object. Blocks
__proto__/constructorattacks and slightly changes the shape ofresponse.headers.Description
Summary of changes
Object.create(null)for the headers map inlib/helpers/parseHeaders.js.jsdomtodependencies; updatedpackage-lock.json.Reasoning
__proto__could modify object prototypes. This hardens parsing and closes that vector.Additional context
response.headersis now prototype-less. Avoid directresponse.headers.hasOwnProperty(...); useObject.prototype.hasOwnProperty.call(response.headers, key).jsdomis required at runtime. It may belong indevDependencies.Docs
response.headersis a plain dictionary (no prototype). Show examples usingObject.prototype.hasOwnProperty.call(headers, 'header-name').Testing
__proto__does not pollute global prototypes.response.headersstill work as expected.Written for commit 2574e1c. Summary will update on new commits.