Skip to content

fix(security): record dependencies without walking into the prototype - #13

Merged
rjrodger merged 1 commit into
mainfrom
claude/proto-pollution
Aug 18, 2026
Merged

fix(security): record dependencies without walking into the prototype#13
rjrodger merged 1 commit into
mainfrom
claude/proto-pollution

Conversation

@rjrodger

Copy link
Copy Markdown
Contributor

Found by an org-wide sweep for the idiom that was live in @jsonic/toml.

depmap[parent] = depmap[parent] || {} indexes by source path, so the key is only as trustworthy as the tree being resolved. On an ordinary object depmap['__proto__'] answers with Object.prototype — truthy, so the || never fires and the dependency is recorded onto the prototype of every object in the process.

Lower severity than the toml case: it needs a source path that is exactly __proto__, not merely a document you did not write.

The map is caller-supplied via msmeta.deps, so its prototype is not ours to remove. Instead the read is an own-property check, which stops an inherited name masquerading as an existing entry, and the write is a defineProperty, which creates an own property rather than invoking the __proto__ setter.

Suite unchanged: 35 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeS3Phjrv21moqauXAdhfr

`depmap[parent] = depmap[parent] || {}` indexes by SOURCE PATH, so the
key is only as trustworthy as the tree being resolved. On an ordinary
object `depmap['__proto__']` answers with `Object.prototype` — truthy,
so the `||` never fires and the dependency is recorded onto the
prototype of every object in the process.
The map is caller-supplied via `msmeta.deps`, so its prototype is not
ours to remove. Instead the read is an own-property check, which stops
an inherited name masquerading as an existing entry, and the write is a
`defineProperty`, which creates an own property rather than invoking the
`__proto__` setter.
Suite unchanged: 35 tests, 0 failures.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeS3Phjrv21moqauXAdhfr
@rjrodger
rjrodger merged commit 941a57c into mainAug 18, 2026
8 checks passed
@rjrodger
rjrodger deleted the claude/proto-pollution branch August 18, 2026 00:34
Sign up for freeto 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

@rjrodger