fix: harden safe-proxy CONNECT tunnels and stop flagging CDN 200s as blocked - #287
Open
ayushsingh82 wants to merge 1 commit into
Open
fix: harden safe-proxy CONNECT tunnels and stop flagging CDN 200s as blocked#287ayushsingh82 wants to merge 1 commit into
ayushsingh82 wants to merge 1 commit into
Conversation
…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
Contributor
🟢 No documentation gap found — medium confidenceThe automated review found no documentation gap in the supplied changes. This review is advisory and does not block merging. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
errorhandlers on both the client and upstream sockets in the CONNECT tunnel (plus tracked-socket teardown inclose()) so a write to an already half-closed peer no longer crashes the process with an unhandledEPIPE, andclose()no longer hangs on in-flight tunnels.isChallengeResponsenow matches challenge markers only against the response body (plus a small set of challenge-specific header names likecf-mitigated), so a plain Cloudflare-fronted 200 no longer tripsFETCH_BLOCKED.Fixes #283
Test plan
npx tsc --noEmitsrc/fetch/safe-proxy.test.ts(tunnel reset doesn't crash the process;close()tears down in-flight tunnels instead of hanging) andsrc/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.