Skip to content

fix(security): the rule map has no prototype - #6

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

fix(security): the rule map has no prototype#6
rjrodger merged 1 commit into
mainfrom
claude/proto-pollution

Conversation

@rjrodger

Copy link
Copy Markdown
Contributor

Latent, not live — flagged by an org-wide sweep for the same idiom that was live in @jsonic/toml, and cheap enough to close.

ruleFor indexes the grammar spec by rule name with rule[rn] || {}, and on an ordinary object that idiom cannot tell an absent rule from an inherited one: rule['__proto__'] and rule['constructor'] both answer truthy, so the || would not fire and the alts would be attached to Object.prototype rather than to a rule.

Rule names come from a plugin's own configuration rather than from parsed text, so nothing reaches this today. But a grammar is free to name a rule anything, and having no prototype here costs nothing.

Suite unchanged: 9 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeS3Phjrv21moqauXAdhfr

`ruleFor` indexes the grammar spec by rule name with `rule[rn] || {}`,
and on an ordinary object that idiom cannot tell an absent rule from an
inherited one: `rule['__proto__']` and `rule['constructor']` both answer
truthy, so the `||` would not fire and the alts would be attached to
`Object.prototype` rather than to a rule.

Latent rather than live — rule names come from a plugin's own
configuration, not from parsed text — but a grammar is free to name a
rule anything, and having no prototype here costs nothing.

Suite unchanged: 9 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 e9f904b into main Aug 18, 2026
11 checks passed
@rjrodger
rjrodger deleted the claude/proto-pollution branch August 18, 2026 00:34
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