Repository navigation
feat(rules): security/form-captcha recognises honeypot fields and reports info #2228 - #2237
Merged
Merged
Conversation
…orts info #2228 Signed-off-by: Nik Cubrilovic <[email protected]>
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.
Summary
security/form-captchanow recognises honeypot fields. If a public form has no CAPTCHA signal but does have a decoy field, it reports as info with a message that names the honeypot, instead of a warning. To count as a decoy, a field must have all three of:tabindex="-1",autocomplete="off",hiddenattribute,aria-hidden="true", an inlinedisplay:none/visibility:hidden/opacity:0/ zero size /clip:rect(0,position:absolute|fixedwith a negative offset, a hidden utility class (hidden,d-none,sr-only,visually-hidden,screen-reader-text,hp,honeypot), or anhp/honeypot/traptoken in the field's name or id.On a page with mixed forms, the check still warns, lists only the forms with no signal at all, and reports the honeypot forms in
details.honeypotForms. A honeypot never upgrades a form to pass.Closes #2228
Acceptance criteria
tabindex=-1 autocomplete=offinput reports info, not warn/error. Test:form-captcha-honeypot-2228.test.ts> "off-screen tabindex=-1 autocomplete=off input -> info naming the honeypot", plus the wrapper and hidden-signal cases.details), the five near-miss "not a honeypot" cases, and the unchangedform-captcha.test.ts.docs/rules/security/form-captcha.mdx(new info outcome and a honeypot section).Gates
packages/rules:format:checkclean,lintexit 0,typecheck(all 3 tsconfigs) cleanbun teston the new file plusform-captcha.test.ts,degenerate-pages-and-hostile-ids-1270-1276.test.tsandwebmcp.test.ts: 128 pass, 0 fail (before the final doc edits)bun run scripts/test-suites.ts --run rules): 12621 pass, 24 todo, 0 fail across 412 filesbun run test:engine: 272 pass, 1 skip, 0 faildocs-rule-pages+docs-category-table: 9 pass.make validatein docs/: ok (74 script tests pass)bun scripts/changelog.ts check: OK. Entry:changelog.d/2228-form-captcha-honeypot.changed.mdAgent skill
The squirrelscan agent skill needs no change.