Repository navigation
fix(waf-detect): JSD pages are not challenges, a provider's name is not its signature (#666, #667) - #692
Conversation
…ot its signature #666 #667 #666: Cloudflare JavaScript Detections loads a script from /cdn-cgi/challenge-platform/ on ordinary pages, and the bare directory was a challenge marker, so a small 200 page through Cloudflare was set aside from scoring and ax/agent-blocking reported GPTBot and Claude-User as blocked. Challenge markers are now split: markup only a challenge carries (the orchestrate challenge script, _cf_chl_opt, __cf_chl_, Imperva's incident line, Akamai's reference after its denial) and wording any page can say ("Just a moment"), which counts only on a 401/403/429/503. The agent-access probe uses the challenge script, _cf_chl_opt and the "Just a moment" title. #667: body attribution matched provider names in prose (/imperva/i and the same shape for DataDome, PerimeterX, Kasada, Sucuri, Akamai and Cloudflare) and unanchored script names (dd.js, ips.js, cd.js). Every provider's body patterns are now infrastructure it emits: script and captcha hosts, client objects, block-page titles and reference formats. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of #692 (JSD pages no longer read as challenges, provider names no longer used as signatures) No blocking problems found. The split into markup and text patterns is sound, and no references to the removed
Test coverage is strong: positives and negatives per provider, status gating, the 4 KB head case, and headerless-403 behaviour. The CHANGELOG and docs are updated, and the score change on affected sites is documented. |
…cept en dashes and entity colons #666 #667 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Triage of the review, fixed in b19fdcf:
|
|
Review of #692 (JSD false-positive challenge + provider-name signatures) I read the full diff. I did not run the test suite. The change is well scoped. Splitting challenge markers into markup (challenge-only) and text (any page can say it) is a clean model. The gating in
I found no correctness, security or test-coverage problems that should block the merge. |
…bounded Akamai scan #666 #667 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Second review, f0dded0:
|
|
Reviewed the diff (detection logic, agent-access probe, docs, tests). I found no blocking problems. The change fits the problem. It splits challenge markers into markup and text, requires a challenge status for text-only matches, and swaps provider names for signatures the provider's own infrastructure emits.
Test coverage is good. It covers JSD pages, real challenges, prose mentions per provider, headerless 403s and the regex performance case. |
|
Third review: no code change, triage below.
|
…ord boundary (CodeQL missing-regexp-anchor) #667 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of #692. The change is well-reasoned and the tests cover the new signatures. I found no blocking issues.
|
…oads them (CodeQL missing-regexp-anchor) #667 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the source changes (agent-access, waf-detect providers/challenge, utils re-exports). I found no blocking problems. The removed
|
|
Fourth review (on 1120d18, which also clears the two CodeQL
|
|
Reviewed the diff for the waf-detect, utils and crawler changes. I didn't run the tests.
Overall the change is well-reasoned and well-tested. It narrows the false positives from #666 and #667 without dropping real challenge signals. I found nothing blocking. |
Closes #666
Closes #667
What changed
#666, JavaScript Detections read as a challenge. Cloudflare's JavaScript Detections (Bot Fight Mode turns it on) injects a script into ordinary pages that loads
/cdn-cgi/challenge-platform/scripts/jsd/main.js./challenge-platform/iwas a challenge-interstitial marker, so any 200 page from Cloudflare with the snippet in its first 10 KB was classified as a challenge and set aside from page-level scoring. The same bare-directory check in the agent-access probe (packages/crawler/src/agent-access.ts) madeax/agent-blockingFAIL with "Claude-User is blocked (bot challenge (challenge-platform))" on such a homepage.packages/waf-detect/src/providers.ts: challenge markers are split intoCHALLENGE_MARKUP_PATTERNS(only a challenge or block page carries them: the challenge's own scriptCLOUDFLARE_CHALLENGE_SCRIPT=/cdn-cgi/challenge-platform/(h/<x>/)?orchestrate/,_cf_chl_opt,__cf_chl_,cf-browser-verification, Imperva's incident line with its id, Akamai's entity-encoded reference or its reference id after "Access Denied", PerimeterX's captcha) andCHALLENGE_TEXT_PATTERNS(wording any page can say: "just a moment", "checking your browser", access denied + reference).challenge.ts: markup counts with a challenge status (401/403/429/503) or WAF attribution, as before; wording now counts only with a challenge status.agent-access.ts: the challenge script or__cf_chl_/_cf_chl_optin the first 10 KB, and a<title>starting "Just a moment" (attributes allowed) in the first 4 KB, instead of the bare directory and the phrase anywhere in the first 4 KB.#667, a provider's name as its signature.
CONTENT_PATTERNS(body attribution, used for the report's technologies, the challenge gate on 200 pages, and 403 classification of external links) matched/imperva/i, and the same shape existed for most providers. Checked every provider and replaced each prose pattern with what the provider's infrastructure emits:/imperva/i,/powered by incapsula/i, bareincapsula incident id/_Incapsula_Resource/datadome/i,/dd\.js/(matchedadd.js)js.datadome.co,captcha-delivery.com,ddjskey/perimeterx/ipx-captcha,_pxCaptcha,_pxAppId,client.perimeterx.net/kasada/i,/ips\.js/i(matchedtips.js),/cd\.js/(matchedabcd.js)window.KPSDK,KPSDK.configure,ips.jsunder Kasada's two-UUID path/sucuri website firewall/i/access denied.*akamai/i,/reference\s*#\s*[\d.]+/i(matched "Reference #3")18.9d367a83.1614887475.2b3c78d, entity form,errors.edgesuite.net/checking your browser/i,/cloudflare ray id/i_cf_chl_opt,/cdn-cgi/challenge-platform/(attribution only: a JSD page IS on Cloudflare)CHALLENGE_INTERSTITIAL_PATTERNSis replaced by the two lists above (no consumers outside the package;@squirrelscan/utils/wafre-exports updated).Behaviour changes worth knowing: sites with JSD get their pages scored, so their scores change (the fixture below went from 97, computed from site rules alone, to 50 with its three pages scored). A headerless 403 whose body only named a provider is now an ordinary refusal in external link checks.
Acceptance evidence
BEFORE = squirrel 0.0.108 binary, AFTER = CLI from this branch,
audit <fixture> --http --refresh -m 5 -f json, local fixtures (Cloudflare headersserver: cloudflare,cf-ray,cf-cache-status; pages listed in a sitemap):Detected 3 challenge/interstitial page(s) via Cloudflare; these pages were excluded from page-level rule scoring.;ax/agent-blockingfail "Claude-User is blocked (bot challenge (challenge-platform))" + warn for GPTBotax/agent-blockingissue, still attributed to Cloudflarecf-mitigated: challengemanaged-challenge pagesDetected 1 challenge/interstitial page(s) via Imperva/Incapsula; technologiesImperva/Incapsula (high); agent-blocking fail (just-a-moment)/_Incapsula_Resourceiframe + incident line) behind an ordinary homeDetected 1 ... via Imperva/IncapsulaDetected 1 challenge/interstitial page(s) via Imperva/IncapsulaUnit tests:
packages/waf-detect/tests/content-signatures.test.ts(new): JSD-only small page at 200 is not a challenge but is Cloudflare; a managed challenge at 403/503 and 200 is "Cloudflare"; wording alone needs a challenge status; a prose roundup naming every provider attributes nothing and is not a challenge; the Imperva block page is Imperva at 200 and 403; one positive per provider signature (18) and 13 prose/filename negatives; Akamai deny page at 200 in both forms; a page quoting an Akamai reference is not a challenge; headerless 403isLikelyWafBlockper provider and for prose.packages/crawler/tests/ax-prefetch.test.ts: orchestrate script,_cf_chl_opt, JSD and in-text "Just a moment" negatives, a challenge whose scripts sit past the 4 KB head caught by its attributed<title>.apps/cli/tests/utils/waf.test.ts: two fake ray ids (xyz) made realistic.Local gates:
tsgo --noEmitclean in packages/waf-detect, utils, crawler, audit-engine and apps/cli. Tests, explicit files, all pass: the new waf-detect file; crawler ax-prefetch, status-guards, full-crawl-harness, root-failure-classification, render-reuse-source-hash; cli utils/waf, audit/adapter-waf, crawler/cloud-fetcher; audit-engine soft404-confirm, waf-tech-set-cookie, cloud-tech-section, failure-classification, page-features-noindex-golden, streaming-rules-golden, streaming-sitequery-universe-golden, cloud-prefetch, rate-limited-pages-e2e, refused-fetches-e2e; rules agent-blocking, pay-per-crawl, rate-limited-links; utils fingerprint, cdn; fetchers conditional-render. oxfmt/oxlint clean on the touched CLI test.scripts/test-suites.ts --checkok. Docs[email protected] check --strictpasses. Two codex rounds; fixed: a 200 Akamai deny page lost, an attributed<title>missed, Imperva line with tags,KPSDK/Sucuri prose, an Akamai reference quoted in help text, doc wording.Docs:
docs/guides/failed-audits.mdx(#waf-challenge: what a recognised challenge body is, wording needs a challenge status, JSD never counts, same test for page exclusion),docs/rules/ax/agent-blocking.mdx(what counts as a bot challenge for the probes, the reason strings). CHANGELOG under Unreleased / Fixed.Agent skill (
squirrelscan/skills): no change needed; the skill does not describe WAF or challenge detection.Follow-ups (not fixed here)
window.KPSDK,js.datadome.co, or anIncapsula incident ID: 123line) is still attributed. Closing that needs DOM context (scriptsrcand inline script bodies only), not more patterns.cf-mitigatedheader, another title and its scripts past 10 KB is still missed.