Repository navigation
Disable upstream redirects in all proxy modes - #17032
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Critical redirect-handling flaws allow clients to bypass proxy authorization and response filtering, while guard enrichment incorrectly accepts redirect stubs as successful data.
3 open issues
What changed in this PR
This PR addresses #17031 by making GitHub API redirects client-driven in every proxy mode, rather than fetching redirect targets under the original repository’s authorization and labels.
Changes:
- Disable upstream redirect following for all proxy requests.
- Add regression coverage for coarse authorization, request counts, and delegated redirect targets.
- Document the all-mode policy and existing API URL rewriting and external download behavior.
| File | Description |
|---|---|
internal/proxy/proxy.go |
Applies an unconditional no-follow policy to upstream requests. |
internal/proxy/handler_difc_test.go |
Tests redirect authorization, single-request forwarding, and delegated target denial. |
docs/PROXY_MODE.md |
Documents redirects across all modes and client-facing URL handling. |
Review effort: Max (adaptive)
| return doWithoutFollowingRedirects(s.httpClient, req) | ||
| } | ||
| return s.httpClient.Do(req) | ||
| return doWithoutFollowingRedirects(s.httpClient, req) |
| return doWithoutFollowingRedirects(s.httpClient, req) | ||
| } | ||
| return s.httpClient.Do(req) | ||
| return doWithoutFollowingRedirects(s.httpClient, req) |
| return doWithoutFollowingRedirects(s.httpClient, req) | ||
| } | ||
| return s.httpClient.Do(req) | ||
| return doWithoutFollowingRedirects(s.httpClient, req) |
|
@copilot address review feedback |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Addressed the redirect authorization, enrichment, and URL-rewriting feedback. Commit: |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Fixed the testifylint failure by moving the fatal assertion outside the HTTP handler. |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No reaction, star, issue, comment, branch, file, or PR was created in any part of this run.
|

Default and delegation modes followed upstream redirects while authorizing and labeling responses against the original repository path. Rename or transfer redirects could therefore return data outside the intended scope.
CheckRedirectunconditionally and use no-redirect forwarding for every request, exposing 3xx responses to existing coarse authorization.LocationURLs so clients reauthorize the target. Preserve authorized external download URLs; document the all-mode policy.