You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security(oauth): token POST credentials can leak through redirects #729
OAuth token requests validate only the initial token endpoint. The supplied or default http.Client can follow HTTP 307/308 redirects while replaying the POST body to another origin or an HTTPS-to-HTTP destination.
The replayed form may contain authorization codes, PKCE verifiers, refresh tokens, client secrets, and client IDs.
Affected code
internal/oauth/flow.go:113-151 builds the sensitive token form.
internal/oauth/flow.go:154-180 validates only the initial URL and calls client.Do without a token-specific redirect policy.
internal/mcp/oauth.go:224-247 uses the same implementation for MCP OAuth login and refresh.
internal/oauth/flow_test.go:185-190 covers an initially insecure endpoint but not redirected endpoints.
Reproduction outline
Configure or discover an HTTPS token endpoint.
Have that endpoint return 307 Temporary Redirect or 308 Permanent Redirect to a different origin or an HTTP URL.
Perform authorization-code exchange or token refresh.
Observe that Go can replay the POST and form body at the redirect target.
Impact
Authorization credentials and long-lived refresh tokens can be disclosed cross-origin or over plaintext despite the initial endpoint passing HTTPS validation.
Suggested fix
Clone the selected HTTP client and install a token-specific CheckRedirect policy. The safest default is to reject all token-endpoint redirects.
Add 307/308 tests for both code exchange and refresh and assert that the redirect target receives no request body or credential-bearing request.
Activity
shriza1991 commentedon Jul 18, 2026
Hi, I'd like to work on this, can you please assign this to me if its available?
Vasanthdev2004 commentedon Jul 18, 2026
assigned @shriza1991
fix(oauth): refuse redirects on credential POSTs (#729)
fix(oauth): refuse redirects on credential POSTs (#729) (#741)