Repository navigation
feat(crawler,waf-detect): fail the audit on WAF and bot challenge pages, list blocked pages #1253 - #1257
Conversation
…ders across 200/202/403/405/429/503 #1253 Provider-specific headers and page markers plus status and page-size gates, with a verdict (blocked, suspect, clear) and the matched signal. Per-provider real-shaped fixtures, each with a near-miss that must stay clear. Signed-off-by: Nik Cubrilovic <[email protected]>
… other blocked pages #1253 The crawler records provider, signal and status for a blocked fetch (the seed by URL, since a sitemap can enqueue it first). A blocked seed makes the audit blocked with no score and exit code 3; other blocked pages are left out of rule evaluation and listed in the console, text, markdown, llm, json and html outputs. A provider challenge served as 429 is no longer treated as throttling. Signed-off-by: Nik Cubrilovic <[email protected]>
…Blocked field #1253 Signed-off-by: Nik Cubrilovic <[email protected]>
…e page kept #1253 Signed-off-by: Nik Cubrilovic <[email protected]>
… real block and negative classes and the provider technologies #1253 [skip ci] Signed-off-by: Nik Cubrilovic <[email protected]>
…ck text; Vercel BotID and F5 BIG-IP as technologies #1253 Signed-off-by: Nik Cubrilovic <[email protected]>
…efusal and its app id, drop a regex trim #1253 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the detection, crawler, report and CLI changes. I did not run the test suites. The design is careful: every rule needs a provider-specific marker plus a status or size shape, and report fields are sanitised at the renderer. Findings:
Checklist from AGENTS.md: run the |
Signed-off-by: Nik Cubrilovic <[email protected]>
|
Update-branch (merge of main, rule A check): new head 42c0240 = merge commit with parents dcd5408 (approved head) and 306baaa (main tip). The PR's own non-CHANGELOG patch is unchanged: git patch-id --stable is 7b504803a0071e026e0e5b592115dc7f86dbee93 for both, same files, same +/- lines; the raw diffs differ only in blob index lines and hunk line offsets because main moved. CHANGELOG: three Unreleased bullets kept. Pin for merge: 42c0240. |
|
Review of #1257 (WAF block detection). I read the The classifier is well built:
Findings:
Test coverage is good (fixtures per provider, crawler status guards, engine seed-block, report and console). Beyond the 200 negative test above, I'd add a test that a normal 200 page with the Cloudflare JS Detections script, or a Turnstile widget, stays clear. I found no critical or high issues. |
Closes #1253.
What changed
Detection (
packages/waf-detect):classifyWafResponse/inspectWafChallengePagereturn a verdict (blocked,suspect,clear), the provider and the matched signal. Twelve providers: Cloudflare, Akamai, DataDome, Kasada, HUMAN (PerimeterX), Imperva, Sucuri, AWS WAF, F5, Vercel, Wordfence, Radware. Every rule is a provider-specific header or page marker plus the status and page-size shape that provider's block page has. A vendor name, a vendor script on a normal page, or a CAPTCHA widget never counts.WafProvideris unchanged (the cloud's stored link-check results use it); the added providers are a newWafBlockProvidersuperset.Crawler: a blocked response fails the fetch (any status,
429included: a provider challenge is not throttling) and carries provider and signal.CrawlStats.wafBlockedrecords the seed block and up to 50 other blocked pages. The seed is identified by URL, not bysource, because a sitemap listing the homepage enqueues it first.Status and reports: a blocked seed makes the audit
blockedwith no score (even when other pages were fetched),statusReasonCode: http_4xx, reason... blocked_by_<provider>: <Provider> served a challenge or block page (<signal>), HTTP <status>, for <host>.squirrel auditexits3. Other blocked pages are never audited or scored and are counted and listed in console, text, markdown, llm, json and html (wafBlocked). The "Site uses X protection" warning is unchanged.Evidence for each provider
x-vercel-mitigatedand the HUMAN branded challenge confirmed by the maintainer's OVH captures too): Cloudflare (managed challenge withcf-mitigated, header-only challenge, "Attention Required!" block), Akamai deny at 403 and at 200, DataDome (two shapes), HUMAN block page andx-px-blocked, Kasada 429.x-amzn-waf-action, 202 challenge, 405 CAPTCHA; the body is built from the documented behaviour).403(access denied).Fixtures say which origin each shape has (
packages/waf-detect/tests/fixtures/waf-blocks.ts). Run over 29 real responses (11 good200pages included): every live block classified, no200page misclassified.Offline detection against the maintainer's captures (scope addition)
Run over the 56 sanitised captures (13,357-site OVH batch): all 33 block samples are blocks with the right provider (Cloudflare challenge 403/429, Cloudflare "Attention Required", Vercel Security Checkpoint 429, DataDome, HUMAN including a restyled challenge, Akamai) and all 23 negatives (200 content behind Akamai, DataDome, Imperva, Kasada/BotID, Sucuri, Cloudflare JS Detections) are not. The only miss was a restyled HUMAN challenge (it keeps the
px-captchamount point): fixed. The synthetic fixtures are derived from the shapes, not copies. Technologies: Akamai, DataDome, Imperva, Sucuri, Cloudflare and Kasada (BotID, on top of Vercel) are reported for 200 content (waf-technologies-1253.test.ts). Neither misattribution reproduces on current main with the captured evidence (Sucuri is not attributed to Vercel or GitHub Pages headers; BotID is a technology and never a block); regression tests pin both. Five negatives (Akamai-04, DataDome-01/02, Kasada-01/02/03/06, Sucuri-01) carry no provider evidence in the capture (empty bodies, Vercel/nginx/Caddy headers only), so no provider can be shown for them.Safety
Regexes run over a 32 KB prefix; pages over 100 KB are never "near-empty". Hostile 1 MB inputs (8 shapes) return in under 3 ms; a normal 50 KB page costs about 0.4 ms. Host regexes are anchored (
src=context, no trailing host) with look-alike near-misses. Site-chosen fields are sanitised and escaped in every renderer.Commands run
tsgo --noEmitin waf-detect, utils, core-contracts, crawler, audit-engine, report, apps/clibun run lint,format:checkin apps/cli;bun run lintin packages/reportbun run scripts/test-suites.ts --check;--run report(984),--run crawler(839)make validatein docs;detect-secrets-hook --baseline .secrets.baselineon changed filessquirrel auditagainst a fixture site (seed challenge at 200 with the sitemap listing it: exit 3; challenge on a non-seed page: audited, listed)Follow-ups
3is new (1 stays operational failure, 2 the--fail-ongate).Docs:
docs/guides/failed-audits.mdx(new section, provider table, remedies),docs/cli/audit.mdxanddocs/guides/ci.mdx(exit code 3),docs/configuration/output.mdx(wafBlocked),docs/configuration/crawler.mdx. Skill: yes, the agent skill needs a note on theblockedstatus, exit code3andwafBlocked.seed.code; a private issue with theskillslabel is for the maintainer to file.