Skip to content

fix: harden safe-proxy CONNECT tunnels and stop flagging CDN 200s as blocked - #287

Open
ayushsingh82 wants to merge 1 commit into
agentrhq:mainfrom
ayushsingh82:fix/283-web-fetch-proxy-classify
Open

fix: harden safe-proxy CONNECT tunnels and stop flagging CDN 200s as blocked#287
ayushsingh82 wants to merge 1 commit into
agentrhq:mainfrom
ayushsingh82:fix/283-web-fetch-proxy-classify

Conversation

@ayushsingh82

Copy link
Copy Markdown

Summary

  • Persistent error handlers on both the client and upstream sockets in the CONNECT tunnel (plus tracked-socket teardown in close()) so a write to an already half-closed peer no longer crashes the process with an unhandled EPIPE, and close() no longer hangs on in-flight tunnels.
  • isChallengeResponse now matches challenge markers only against the response body (plus a small set of challenge-specific header names like cf-mitigated), so a plain Cloudflare-fronted 200 no longer trips FETCH_BLOCKED.

Fixes #283

Test plan

  • npx tsc --noEmit
  • Added regression tests in src/fetch/safe-proxy.test.ts (tunnel reset doesn't crash the process; close() tears down in-flight tunnels instead of hanging) and src/fetch/classify.test.ts (Cloudflare-fronted 200 with a normal body is not flagged); verified both fail against the pre-fix code and pass after.

…blocked

Persistent error handlers on both sides of a CONNECT tunnel (and tracked
socket teardown in close()) stop a half-closed peer write from crashing
the process with an unhandled EPIPE, and close() no longer hangs on
in-flight tunnels. isChallengeResponse now only matches challenge
markers against the response body (plus a few challenge-specific header
names), so a plain Cloudflare-fronted 200 no longer trips FETCH_BLOCKED.

Fixes agentrhq#283
@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.

@ayushsingh82

Copy link
Copy Markdown
Author

Fixes #283@ngaurav this resolves both the EPIPE crash and the FETCH_BLOCKED false positive. Ready for review.

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.

web fetch broken: unhandled EPIPE crash in safe-proxy, plus FETCH_BLOCKED false positive on Cloudflare-fronted 200s

1 participant