Repository navigation
Consolidate HTTP redirect-suppression policy - #17086
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the shared redirect-suppression change.
No open issues 🎉
What changed in this PR
Consolidates redirect suppression into a shared HTTP utility, addressing #17057 while preserving the proxy, Azure OIDC, and MCP clients’ existing behavior.
Changes:
- Adds
httputil.NoRedirectPolicywith security documentation and tests covering five redirect status codes. - Replaces duplicate callbacks and removes the proxy’s redundant constructor assignment, preserving its per-request override without modifying the original client.
- Leaves schema validation’s separate redirect protections unchanged.
| File | Description |
|---|---|
internal/proxy/proxy.go |
Uses the shared policy on client copies and removes redundant initialization. |
internal/proxy/new_comprehensive_test.go |
Removes the obsolete constructor-policy assertion and updates its comment. |
internal/proxy/forward_to_github_test.go |
Checks that the per-request override preserves the original client’s policy. |
internal/oidc/azure.go |
Uses the shared policy for Azure token requests. |
internal/mcp/http_transport_client.go |
Uses the shared policy for OIDC-authenticated MCP requests. |
internal/httputil/httputil.go |
Defines and documents the shared redirect-suppression policy. |
internal/httputil/httputil_test.go |
Tests redirect suppression and preservation of response status, headers, and body. |
Review effort: Balanced (adaptive)
This comment has been minimized.
This comment has been minimized.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Fixed the two |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked in any part. Reads succeeded on both surfaces (A, C).
|
Proxy, Azure OIDC, and MCP HTTP clients duplicate the same redirect-suppression callback; the proxy also assigns it redundantly.
httputil.NoRedirectPolicy, returninghttp.ErrUseLastResponseand documenting the security rationale.