Skip to content

Fix Denial of Service via __proto__ Key in mergeConfig#7369

Merged
jasonsaayman merged 2 commits intov1.xfrom
sec/prevent-dos-via__proto__key-in-merge-config
Feb 4, 2026
Merged

Fix Denial of Service via __proto__ Key in mergeConfig#7369
jasonsaayman merged 2 commits intov1.xfrom
sec/prevent-dos-via__proto__key-in-merge-config

Conversation

@jasonsaayman
Copy link
Member

@jasonsaayman jasonsaayman commented Feb 4, 2026


Summary by cubic

Harden config and object merges to block prototype pollution by ignoring proto, constructor, and prototype keys. Prevents denial-of-service when merging user input.

  • Bug Fixes
    • Filter dangerous keys in mergeConfig and utils.merge.
    • Use own-key check when selecting merge strategy.
    • Added unit tests for top-level and nested cases; no API changes.

Written for commit 14440e3. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this Feb 4, 2026
@jasonsaayman jasonsaayman added priority::high A high priority issue commit::fix The PR is related to a bugfix labels Feb 4, 2026
Copilot AI review requested due to automatic review settings February 4, 2026 17:37
@jasonsaayman jasonsaayman added the type::security The PR is a secuirty related changed normally from a CVE label Feb 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses a Denial of Service vulnerability via prototype pollution by adding guards against dangerous property keys (proto, constructor, prototype) in the mergeConfig function.

Changes:

  • Added checks to skip dangerous property keys that could lead to prototype pollution attacks
  • Changed property lookup from direct bracket access to Object.hasOwn() for safer property checking
  • Applied code formatting changes (quote style and multi-line formatting)

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 1 file

Confidence score: 2/5

  • The __proto__ pollution fix in lib/core/mergeConfig.js only guards top-level keys, so nested objects (e.g., inside headers) can still reach utils.merge, which leaves a concrete security/regression risk.
  • Using Object.hasOwn in lib/core/mergeConfig.js may crash on older supported Node.js versions (e.g., 14), creating runtime failures in those environments.
  • Pay close attention to lib/core/mergeConfig.js - incomplete nested __proto__ protection and potential Node.js compatibility issues.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="lib/core/mergeConfig.js">

<violation number="1" location="lib/core/mergeConfig.js:103">
P1: The fix for `__proto__` pollution is incomplete because it only checks top-level keys. Nested objects containing `__proto__` (e.g., in `headers`) are passed to `utils.merge` (via `mergeDeepProperties`), which is still vulnerable to prototype pollution. This allows attackers to bypass the fix by nesting the payload.

To fully fix this, `utils.merge` in `lib/utils.js` should be updated to skip `__proto__`, `constructor`, and `prototype` keys during deep merges.</violation>

<violation number="2" location="lib/core/mergeConfig.js:109">
P2: `Object.hasOwn` was added in Node.js 16.9.0 and is not supported in older environments that Axios likely supports (e.g., Node.js 14). Using it without a polyfill will cause crashes in those environments. Consider using `Object.prototype.hasOwnProperty.call` for better compatibility.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jasonsaayman jasonsaayman merged commit 28c7215 into v1.x Feb 4, 2026
11 checks passed
@jasonsaayman jasonsaayman deleted the sec/prevent-dos-via__proto__key-in-merge-config branch February 4, 2026 18:25
@arnoldc
Copy link

arnoldc commented Feb 12, 2026

is there a possibility that this will be fix at 0.30.x versions

@FeBe95
Copy link

FeBe95 commented Feb 18, 2026

@arnoldc This has been fixed in version 0.30.3, which has just been released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::high A high priority issue type::security The PR is a secuirty related changed normally from a CVE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants