You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1b63d53
Browse filesBrowse the repository at this point in the historyBrowse files
Add an eighth check: bot-protection/CAPTCHA detection
Requested as this session's next large feature. Many .gov sites sit
behind Cloudflare Turnstile, reCAPTCHA, or hCaptcha. Right now that
silently breaks every other check ("No <form> element found") with no
indication of why — a real, misleading finding that implies the form
is broken when the actual cause is automated testing getting blocked
before it ever reached the real page.
check_bot_protection detects:
- reCAPTCHA / hCaptcha / Cloudflare Turnstile via their standard
widget markup, iframe/script src patterns, or global JS objects
(window.grecaptcha / window.hcaptcha).
- A full-page Cloudflare JS-challenge interstitial ("Just a
moment...", "Checking your browser...").
- Generic "verify you're human" / "are you a robot" wording as a
fallback when none of the above match anything specific.
Always Warn, never Fail: none of this is evidence the *form* itself is
broken (a real person, unlike a headless browser, passes a CAPTCHA
fine) — it's a heuristic limit on what formwatch could verify, exactly
what Warn already means elsewhere in this codebase. Distinguishes
"challenge widget on an otherwise-present, testable form" (submission
just can't be tested with --submit) from "full-page block, no form
visible at all" (testing never got anywhere near the real page), since
those call for different reactions from whoever reads the report.
Added as the first entry in run_all's result vec (before Submission
flow) since "is this even the real page" is conceptually the first
question. Gets a screenshot on Warn for free via run_safely, same as
every other check.
Verified all three outcomes (widget-on-real-form Warn, full-page-block
Warn, ordinary-form Pass) are meaningful by mutating check_bot_protection
three separate ways — forcing blocking to false, to true, and forcing
`found` to always be non-empty — and confirming each predicted test
failure occurred exactly as expected, before restoring the real logic.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
if (document.querySelector('.cf-turnstile, iframe[src*="challenges.cloudflare.com"]')) found.push('Cloudflare Turnstile');
929
+
const cloudflareChallengePage = title.includes('just a moment')
930
+
|| bodyText.includes('checking your browser')
931
+
|| bodyText.includes('checking if the site connection is secure');
932
+
if (cloudflareChallengePage) found.push('Cloudflare challenge page');
933
+
if (found.length === 0 && /verify you.{0,3}re (a )?human|are you a robot|prove you.{0,3}re not a robot|complete the (security check|challenge)/.test(bodyText)) {
0 commit comments