fix(security): the rule map has no prototype - #6
Merged
Conversation
`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
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 free
to 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.
Latent, not live — flagged by an org-wide sweep for the same idiom that was live in
@jsonic/toml, and cheap enough to close.ruleForindexes the grammar spec by rule name withrule[rn] || {}, and on an ordinary object that idiom cannot tell an absent rule from an inherited one:rule['__proto__']andrule['constructor']both answer truthy, so the||would not fire and the alts would be attached toObject.prototyperather 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