Skip to content

config: strip credentials on cross-host redirects#901

Open
roidelapluie wants to merge 1 commit intoprometheus:mainfrom
roidelapluie:roidelapluie/fixredirectauth
Open

config: strip credentials on cross-host redirects#901
roidelapluie wants to merge 1 commit intoprometheus:mainfrom
roidelapluie:roidelapluie/fixredirectauth

Conversation

@roidelapluie
Copy link
Copy Markdown
Member

When FollowRedirects is true, credentials (Authorization header, Cookie headers set via HTTPHeaders) were forwarded to any redirect target, including cross-host redirects.

Fix by marking cross-host redirects in the request context inside CheckRedirect, then having each credential round-tripper (bearer, basic auth, OAuth2) skip adding credentials for marked requests. A new sensitiveHeadersStripRT also strips sensitive headers added by headersRoundTripper on cross-host redirects.

This aligns to Go's HTTP client behaviour.

When FollowRedirects is true, credentials (Authorization header, Cookie
headers set via HTTPHeaders) were forwarded to any redirect target,
including cross-host redirects.

Fix by marking cross-host redirects in the request context inside
CheckRedirect, then having each credential round-tripper (bearer, basic
auth, OAuth2) skip adding credentials for marked requests. A new
sensitiveHeadersStripRT also strips sensitive headers added by
headersRoundTripper on cross-host redirects.

This aligns to Go's HTTP client behaviour.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant