Feat: scrub value on input[type=hidden] in attribute-injection-sanitize#185
Merged
Merged
Conversation
Closes #183. Hidden inputs are by definition not user-facing — same asymmetry as the disabled-input case the rule already handles — so an adversarial page can plant instruction-shaped text in `value` that the user has no way to see or clear while the agent reads it directly off the DOM. Extends the selector and scrub branch to cover `input[type="hidden"][value]`; type check is case-insensitive. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #183.
Summary
attribute-injection-sanitizeto also scrubvalueoninput[type="hidden"]— same asymmetry as the existinginput[disabled]case (not user-facing, not editable in the UI, read by browser-use agents directly off the DOM).<input value>remains untouched (documented accepted limitation for the "enabled input inside CSS-hidden wrapper" shape).docs/src/content/docs/rules.mdupdated to reflect the extended trigger.type, clean value preserved, lazy-subtree mutation), and the property test now exercises a disabled / hidden / enabled triplet.Test plan
bun run test src/rules/__tests__/attribute-injection-sanitize.test.ts— 23 passingbun run test src/rules/__tests__/attribute-injection-sanitize.property.test.ts— 4 passingbun run check(biome + eslint)bun run typecheckpre-commit runon changed files🤖 Generated with Claude Code