Skip to content

fix(view): refuse proto-polluting keys in cleanData - #9918

Open
ubeddulla wants to merge 1 commit into
npm:latestfrom
ubeddulla:view-cleandata-proto
Open

fix(view): refuse proto-polluting keys in cleanData#9918
ubeddulla wants to merge 1 commit into
npm:latestfrom
ubeddulla:view-cleandata-proto

Conversation

@ubeddulla

Copy link
Copy Markdown
Contributor

cleanData keys its accumulator by version.version, the manifest's own version field, which a registry controls independently of the semver-validated versions map key. A packument whose version field is __proto__ makes acc[k] resolve to Object.prototype, so the following acc[k][t] = cur[k][t] writes registry data onto Object.prototype during npm view <pkg> --json or npm view <pkg> <field>. Refuse __proto__/constructor/prototype at that merge, matching the guard lib/utils/queryable.js already uses; real versions are semver strings so nothing else changes.

@ubeddulla
ubeddulla requested review from a team as code owners August 26, 2026 07:49
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