Skip to content

fix(uniforms): prototype pollution changing intended behavior#175

Open
bjormpro wants to merge 1 commit into
vercel-labs:mainfrom
bjormpro:patch-1
Open

fix(uniforms): prototype pollution changing intended behavior#175
bjormpro wants to merge 1 commit into
vercel-labs:mainfrom
bjormpro:patch-1

Conversation

@bjormpro

Copy link
Copy Markdown

fix prototype pollution safely without changing intended behavior, guard merge/clone operations against dangerous keys used to reach object prototypes (__proto__, constructor, prototype). The best targeted fix here is:

  1. Add a small helper isUnsafeKey(key: string): boolean.
  2. In mergeInto, skip entries with unsafe keys before recursion or assignment.
  3. In cloneRecord, also skip unsafe keys so cloned objects cannot carry prototype-polluting keys.

This keeps existing merge semantics for normal keys, preserves deep-copy behavior, and addresses both direct assignment and recursive merge paths.

References

lodash, jQuery, extend, just-extend, merge.recursive
CWE-78
CWE-79
CWE-94
CWE-400

fix prototype pollution safely without changing intended behavior, guard merge/clone operations against dangerous keys used to reach object prototypes (`__proto__`, `constructor`, `prototype`). The best targeted fix here is:

1. Add a small helper `isUnsafeKey(key: string): boolean`.
2. In `mergeInto`, skip entries with unsafe keys before recursion or assignment.
3. In `cloneRecord`, also skip unsafe keys so cloned objects cannot carry prototype-polluting keys.

This keeps existing merge semantics for normal keys, preserves deep-copy behavior, and addresses both direct assignment and recursive merge paths.
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

@bjormpro is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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