Skip to content

fix(nested-obj): guard against prototype pollution in path traversal#82

Merged
pyramation merged 1 commit intomainfrom
fix/nested-obj-prototype-pollution
May 9, 2026
Merged

fix(nested-obj): guard against prototype pollution in path traversal#82
pyramation merged 1 commit intomainfrom
fix/nested-obj-prototype-pollution

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented May 9, 2026

Summary

Fixes a prototype pollution vulnerability (CWE-1321) in nested-obj. The set, get, and has methods walked dot-notation paths without filtering unsafe keys, allowing set(obj, '__proto__.x', value) to write to Object.prototype.

The fix extracts path parsing into a shared parsePath helper that rejects __proto__, constructor, and prototype segments with a thrown error before any property traversal occurs. Six new tests verify the guard across all three methods.

Reject unsafe path segments (__proto__, constructor, prototype) in
get, set, and has methods to prevent prototype pollution attacks.

Extracts path parsing into a shared parsePath helper that validates
all segments before traversal.

CWE-1321 / CVSS 3.1 8.2 High
@constructive-io constructive-io deleted a comment from devin-ai-integration Bot May 9, 2026
@pyramation pyramation merged commit 7427219 into main May 9, 2026
44 checks passed
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