Skip to content

fix(commons): skip prototype-polluting keys in _.merge - #3695

Merged
marshallswain merged 1 commit into
crowfrom
fix/commons-merge-proto-pollution-crow
Aug 10, 2026
Merged

fix(commons): skip prototype-polluting keys in _.merge#3695
marshallswain merged 1 commit into
crowfrom
fix/commons-merge-proto-pollution-crow

Conversation

@marshallswain

Copy link
Copy Markdown
Member

Summary

Backport of the Dove fix for GHSA-28xv-ph75-77wh / CVE-2026-54335 to Crow (Feathers 4.x).

The recursive _.merge helper in @feathersjs/commons iterates Object.keys(source). When the source came from JSON.parse('{"__proto__":...}'), __proto__ is returned as an own-enumerable key, so the recursive call resolves target['__proto__'] to Object.prototype and writes onto it.

This adds the standard guard to skip __proto__, constructor, and prototype keys during iteration — the same remediation as dove #3690 / @feathersjs/commons@5.0.45.

  • Tell us about the problem your pull request is solving.
  • Are there any open issues that are related to this?
  • Is this PR dependent on PRs in other repos?

Related: #3690 (dove), #3687 (original report by @ridingsa), GHSA-28xv-ph75-77wh.

No dependency on other repos.

Changes

  • packages/commons/src/utils.ts: skip the three prototype-mutating keys in the merge loop.
  • packages/commons/test/utils.test.ts: regression test confirming a JSON-parsed __proto__ / constructor.prototype source no longer mutates Object.prototype.

Notes

  • No public API change — merge still works for all documented input shapes.
  • After merge, publish @feathersjs/commons@4.5.20 (and bump dependents as needed for the Crow release), then update GHSA-28xv-ph75-77wh with a Crow patched range (<= 4.5.194.5.20).

Reported-by: Andrew Ridings (@ridingsa)

Verification

cd packages/commons && npm test
# 53 passing

Object.keys() returns __proto__ as an own enumerable key for
JSON-parsed sources, causing the recursive merge to write onto
Object.prototype. Skip __proto__/constructor/prototype keys.

Same remediation as dove #3690 / @feathersjs/commons@5.0.45
(GHSA-28xv-ph75-77wh / CVE-2026-54335).

Reported-by: Andrew Ridings (@ridingsa)
@marshallswain
marshallswain merged commit 88794cc into crow Aug 10, 2026
2 checks passed
@marshallswain
marshallswain deleted the fix/commons-merge-proto-pollution-crow branch August 10, 2026 17:10
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