fix: block forbidden keys in Queryable setter to prevent prototype po… · npm/cli@080e3b2 · GitHub
Skip to content

Commit 080e3b2

Browse files
12122Jclaude
authored andcommitted
fix: block forbidden keys in Queryable setter to prevent prototype pollution
Sanitize __proto__, constructor, and prototype keys in the setKeys function to prevent prototype pollution via npm pkg set. Previously, passing __proto__.scripts.postinstall as a key would pollute Object.prototype, causing @npmcli/package-json to write inherited properties to disk and enabling RCE on next npm install. Fixes GHSA-jjm5-4238-9vmw Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c5292fa commit 080e3b2

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

lib/utils/queryable.js

Lines changed: 5 additions & 0 deletions

test/lib/utils/queryable.js

Lines changed: 39 additions & 0 deletions

0 commit comments

Comments
 (0)