Skip to content

fix(crawler,report): seed redirect counts once, suspect WAF pages warn, Wordfence needs its markup #1258 - #1326

Closed
nc9 wants to merge 3 commits into
mainfrom
fix/waf-followups-1258
Closed

nc9 wants to merge 3 commits into
mainfrom
fix/waf-followups-1258

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1258 (AC 1 to 3 done; the sample part of AC 4 needs real responses, see below). Does not close it.

Changes, by item

  1. Seed redirecting to a challenge counted twice. Reproduced: / redirects to /challenge (a Cloudflare challenge) and the sitemap lists /; the report had wafBlocked.total: 2, the destination as seed and the typed URL under pages. The fetcher now records where a blocked response was served after redirects (WafBlockInfo.finalUrl), the crawler treats a blocked fetch that landed on the seed's destination as the seed, and addWafBlockedPage ignores a second sighting of the seed. Result: total: 1, pages: []. The outcome and exit code 3 are unchanged.
  2. suspect did nothing. Two things made it invisible. The detector ran but nothing consumed its verdict, and the pages it fits do not reach the audit as plain pages: a 4xx comes back as a stored error-page record, and a bare 403 fails as blocked. Both places now classify the response and record suspect pages in crawl stats (wafSuspect: total, up to 50 pages, providers) and on the report (AuditReport.wafSuspect). The console prints Note: N page(s) look like a refusal from <provider> but carry no block marker... with the pages, the text and Markdown reports carry a "Suspect pages" block, and JSON has wafSuspect. Page handling is unchanged: the fetch fails or stores exactly as before. LLM, XML and HTML reports are not changed in this PR.
  3. Wordfence precision. The rule now also needs the footer's inline document.write(new Date().toUTCString()) script in the markup view, so a 403 that copies the heading and the "Generated by Wordfence" footer wording is not attributed. Near-miss fixture added; the real-shaped Wordfence fixtures (503 and 403) still match. Evidence for the script is a public support-forum post quoting a block page ("Generated by Wordfence at ... Your computer's time: ...") and my recall that the time is filled by that script; I have not seen the raw HTML of a live Wordfence block, so this is not live-verified.
  4. Netlify and Fastly. No real sample is collected: I have no block page from either, and none is invented. Vendor documentation settles the "documented as indistinguishable" half: Netlify answers a Firewall Traffic Rule block with its ordinary branded 404 page (request chain), and Fastly Next-Gen WAF blocks with 406 by default, configurable, with no documented body (custom response codes). Both are now written up in docs/guides/failed-audits.mdx. The AC checkbox for a real sample stays open until someone triggers a block on a Netlify or Fastly NGWAF test site and shares the headers and body.

Tests

  • apps/cli/tests/cli/audit-waf-followups-1258-e2e.test.ts: real CLI against local sites: the redirecting-seed case (exit 3, total 1, pages empty, seed is the destination); a home page linking to a 406 and a 403 that read as Cloudflare refusals: audit completes, wafSuspect.total 2 with both pages, console warning present. The first case failed with total: 2 before the fix.
  • packages/core-contracts/tests/waf-suspect-1258.test.ts, packages/report/tests/waf-suspect-1258.test.ts, the new Wordfence near-miss in packages/waf-detect/tests/fixtures/waf-blocks.ts.
  • Also run: waf-detect suite (243), crawler status-guards, audit-engine waf tests, scripts/test-suites.ts --run report (1031), cli lint, format:check and tsgo, tsgo on crawler, report, core-contracts, audit-engine and waf-detect, make validate.
  • Not run: the full cli, crawler and rules suites; a live WAF.

Docs: docs/guides/failed-audits.mdx, docs/configuration/output.mdx. Skill: no change needed.

Review round

  • suspect is now a console note (plain, not a yellow warning). It fires on any refusal-shaped short 4xx whose headers name a provider, so a site's own 403 Forbidden behind Cloudflare will also be noted. I have not measured how often that happens on real sites (no corpus run), so the rate is unknown, not low. Marker-based tightening is impossible by definition (suspect means no marker); the note is a pointer, not a verdict. This is a reading of "visible warning" in the AC; say if you want the yellow warning back.
  • Wordfence is attributed when the footer has its generation timestamp OR the inline script (either is evidence of the real page); wording alone no longer is. Fixtures for timestamp-only and script-only added.
  • A second page that redirects to the seed's challenge counts as the seed's page (not listed under pages): test and behaviour stated.
  • Issue for the Netlify/Fastly samples: Collect real Netlify and Fastly Next-Gen WAF block-page samples #1328.

Delta review round (rebased onto v0.0.143)

wafSuspectLines is singular for one page ("1 page looks like a refusal ... but carries no block marker", tested). The LLM report now carries a <waf-suspect> element (tested); the XML and HTML reports do not, and the docs and CHANGELOG say so.

@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up for the Netlify and Fastly samples: #1328

@nc9
nc9 force-pushed the fix/waf-followups-1258 branch 2 times, most recently from ff2e9ce to e56b293 Compare October 30, 2026 07:18
@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.144 as b319b2e0 f5ff2754 ba4ddbba via #1356. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.144. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 2026
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.

1 participant