Skip to content

feat(rules): security/form-captcha recognises honeypot fields and reports info #2228 - #2237

Merged
nc9 merged 1 commit into
mainfrom
boat/form-captcha-honeypot-2228
Nov 22, 2026
Merged

nc9 merged 1 commit into
mainfrom
boat/form-captcha-honeypot-2228

Conversation

@nc9

@nc9 nc9 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Summary

security/form-captcha now 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",
  • one hidden or off-screen signal on the field or on a wrapper inside the form: the hidden attribute, aria-hidden="true", an inline display:none / visibility:hidden / opacity:0 / zero size / clip:rect(0, position:absolute|fixed with a negative offset, a hidden utility class (hidden, d-none, sr-only, visually-hidden, screen-reader-text, hp, honeypot), or an hp/honeypot/trap token 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

  • A form with an off-screen tabindex=-1 autocomplete=off input 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.
  • A form with no protection signal reports as before. Tests: "no protection signal at all still warns as before" (same message, no details), the five near-miss "not a honeypot" cases, and the unchanged form-captcha.test.ts.
  • The rule doc lists the honeypot heuristic: docs/rules/security/form-captcha.mdx (new info outcome and a honeypot section).

Gates

  • packages/rules: format:check clean, lint exit 0, typecheck (all 3 tsconfigs) clean
  • bun test on the new file plus form-captcha.test.ts, degenerate-pages-and-hostile-ids-1270-1276.test.ts and webmcp.test.ts: 128 pass, 0 fail (before the final doc edits)
  • Rules suite as CI runs it (bun run scripts/test-suites.ts --run rules): 12621 pass, 24 todo, 0 fail across 412 files
  • bun run test:engine: 272 pass, 1 skip, 0 fail
  • docs-rule-pages + docs-category-table: 9 pass. make validate in docs/: ok (74 script tests pass)
  • bun scripts/changelog.ts check: OK. Entry: changelog.d/2228-form-captcha-honeypot.changed.md

Agent skill

The squirrelscan agent skill needs no change.

@nc9
nc9 marked this pull request as ready for review November 22, 2026 05:07
@nc9
nc9 merged commit f83cc38 into main Nov 22, 2026
10 checks passed
@nc9
nc9 deleted the boat/form-captcha-honeypot-2228 branch November 22, 2026 05:19
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.

security/form-captcha: recognise honeypot fields and downgrade to info

1 participant