Repository navigation
Provider HTTP clients follow redirects to subdomains and other ports with the key attached - #1908
Draft
ZeroPoint95 wants to merge 3 commits into
Draft
ZeroPoint95 wants to merge 3 commits into
ZeroPoint95 wants to merge 3 commits into
Conversation
Every client that carries the configured provider key now shares one redirect rule: follow a redirect only when the target keeps the original request's scheme, hostname and effective port, and refuse any other redirect with an error naming the target host. Go's default policy had forwarded Authorization to a redirect that stayed on the same hostname (including another port) or moved to a subdomain of it. The refused redirect is typed so the provider dispatcher stops at once instead of re-asking the same origin until the deadline. Co-Authored-By: CodeAF <267109073+agentfield-bot@users.noreply.github.com> Assisted-by: CodeAF (deepseek-v4-flash-latest)
Policy refused a chain one hop before Go's own 10-redirect cap, and its message named a depth it never reached. Refuse exactly where the standard library stops, and give the boundary-adjacent chain its own assertion. Assisted-by: CodeAF (deepseek-v4-flash-latest) Co-Authored-By: CodeAF <267109073+agentfield-bot@users.noreply.github.com>
The review commit 6731c37 moved the chain cap one hop looser than both the write stage's original and the stdlib default: net/http's defaultCheckRedirect refuses at len(via) >= 10 (client.go:845), checked before the next request is built, so the stock client sends exactly ten requests on an endless same-origin loop while len(via) > 10 let an eleventh out. Restoring >= 10 matches the stdlib depth exactly; the unit test now pins refusal at ten requests in the chain and follow at nine. Verified empirically: on an endless same-origin 307 loop, both the stock default client and a client using Policy send exactly ten requests and stop with "stopped after 10 redirects" (proof harness since removed). Assisted-by: CodeAF (deepseek-v4-flash-latest) Co-Authored-By: CodeAF <267109073+agentfield-bot@users.noreply.github.com>
santoshkumarradha
force-pushed
the
dev
branch
from
October 24, 2026 21:53
a2f0486 to
d68bcf8
Compare
santoshkumarradha
force-pushed
the
zeropoint95/1896-provider-http-clients-follow-redirects-t
branch
from
October 24, 2026 21:54
7f7c441 to
5fb5c6f
Compare
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.
Changes
Closes #1896.
Validation
cd . && go test -count=1 -run TestIssueReproRedirectForwardsKey -v ./internal/provider/ 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL|ok)'; echo "REPRO-EXIT=${PIPESTATUS[0]}".cd . && go test -count=1 -run TestProofParityStockVsPolicyEndlessLoop -v ./internal/redirect/ 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL|ok)'; echo "PARITY-EXIT=${PIPESTATUS[0]}".cd . && go test -count=1 ./internal/namelaw/ 2>&1 | tail -2; echo "NAMELAW-EXIT=${PIPESTATUS[0]}"; make changelog-check 2>&1 | tail -2; echo "CHANGELOG-EXIT=${PIPESTATUS[0]}".by codeaf factory
Factory-Approval: evt_f69a14bd @ZeroPoint95 7f7c441