Skip to content

fix: stop CSP allow-lists triggering challenge detection (#264) - #266

Open
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/264-challenge-header-false-positive
Open

fix: stop CSP allow-lists triggering challenge detection (#264)#266
ankitranjan7 wants to merge 1 commit into
mainfrom
fix/264-challenge-header-false-positive

Conversation

@ankitranjan7

Copy link
Copy Markdown
Contributor

Fixes #264.

isChallengeResponse built its evidence string from every response header, so any site whose content-security-policy allow-lists cdnjs.cloudflare.com or google.com/recaptcha matched challengeMarkers. news.ycombinator.com returned a healthy 200 with the full HTML, got classified as a challenge, ran the whole impit ladder for nothing, and ended in FETCH_BLOCKED.

Change

  • Header evidence limited to headers that describe this response: server, cf-mitigated, cf-chl-*, x-datadome*, set-cookie. CSP/report-to/link are third-party allow-lists and prove nothing.
  • A 200 now needs body evidence. server: cloudflare on a served page is not a challenge — real interstitials say "Just a moment" in the body, which still matches.
  • Body matching unchanged.

Verification

$ node dist/src/main.js web fetch --url https://news.ycombinator.com
# Hacker News   ← front page, plain tier, no ladder

npx vitest run src/fetch/ → 22 passed; npm run typecheck clean. New cases cover the CSP false positive, headers-only 200, and that 403 + server: cloudflare still classifies.

🤖 Generated with Claude Code

isChallengeResponse matched challenge markers against every response header,
so any site whose CSP names cdnjs.cloudflare.com or google.com/recaptcha (HN,
among many) was classified as a challenge: two wasted impit fetches and a
misleading FETCH_BLOCKED for a page that was never blocked.

Header evidence is now limited to headers that describe this response
(server, cf-mitigated, cf-chl-*, x-datadome*, set-cookie), and a 200 needs
body evidence — headers alone never prove a challenge on a served page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🟢 No documentation gap found — medium confidence

The automated review found no documentation gap in the supplied changes.

This review is advisory and does not block merging.

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.

[Bug]: web fetch challenge detection false-positives on CSP headers (news.ycombinator.com fails with FETCH_BLOCKED)

1 participant