Skip to content

fix: Prevent agent HTTP auth redirect leaks#3978

Open
lox wants to merge 1 commit into
mainfrom
lox/agenthttp-auth-redirect
Open

fix: Prevent agent HTTP auth redirect leaks#3978
lox wants to merge 1 commit into
mainfrom
lox/agenthttp-auth-redirect

Conversation

@lox
Copy link
Copy Markdown
Contributor

@lox lox commented Jun 4, 2026

Authenticated agent HTTP clients currently inject credentials in the transport layer, after Go's redirect sanitizer has already decided whether to strip Authorization. If a trusted Buildkite endpoint ever redirected to a different host or scheme, the redirected request could receive the agent token or bearer credential.

This keeps the normal redirect behavior for unauthenticated clients, but authenticated clients now stop at redirects that change scheme or host and return the redirect response instead. Same-origin redirects still follow normally and continue to include the expected authorization header.

For example, an authenticated request from https://agent.buildkite.com/... to a Location: https://example.invalid/... response will no longer follow that redirect with credentials attached, while /old to /new on the same origin continues to work.

@lox lox marked this pull request as ready for review June 4, 2026 09:35
@lox lox requested review from a team as code owners June 4, 2026 09:35
@lox lox added the internal Non-user facing, internal change. label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Non-user facing, internal change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant