Repository navigation
Send an outbound call on as the caller wrote it - #520
Merged
Merged
Conversation
A caller's Request with a body was left unusable when the caller handled redirects itself, and a body given in init was handed on inside a Request the guard had built and cloned. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
🎯 Elite quality (98%) — Fixes body-consumption failures in the egress guard by sending the caller's own arguments, with regression tests for each path. 📦 Medium 🤖 Written by Claude Code — going by its own attribution. Unknown whether a person read it; agents can report that with the 🟢 Low risk — 78 lines of code, and nothing that needs a person. ✅ Reviewed — approved by @daniloradovic. 🩺 Coderbuds triage found nothing that should stop this merge, but worth a look: Adds lazy body capture for oversized bodies with no test in |
Contributor
Author
|
/review |
daniloradovic
approved these changes
Nov 26, 2026
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.
With the outbound guard on, some
fetchcalls that carry a body failed withTypeError: Cannot construct a Request with a Request object that has already been used. GET requests were not affected, so an app could look healthy while its writes failed.What was wrong
The guard builds a
Requestfrom the caller's arguments to read the destination. Building one from a caller's ownRequesttakes that Request's body.redirect: 'manual'or'error'), the guard then sent the caller's original Request, which no longer had a body to send. This fails on every such call, in plain Node as well as under a framework.fetchand rebuilds what it is handed was given something other than what the app wrote.What changed
inputandinit, including itssignal. The guard keeps a copy of the body and reads it only if a 307 or 308 arrives.Every hop is still screened, and a redirect to a disallowed address is still refused.
Checked
tests/protect/egress-callers-own-request.test.ts; five of the eight fail without the change.fetch: GET, POST and PUT with string, bytes and Request bodies, with a timeout signal, with the framework's caching options, and through a 307. All pass.npm testpasses excepttests/field-test-cli-log.test.ts, which fails on my machine on a temp-path difference and does not involve this code.capabilities:checkandtypecheckpass.🤖 Generated with Claude Code