Uh oh!
There was an error while loading. Please reload this page.
fix(security): record dependencies without walking into the prototype - #13
Merged
Conversation
`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_01KeS3Phjrv21moqauXAdhfrUh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 objectdepmap['__proto__']answers withObject.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 adefineProperty, 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