Skip to content

Only send authentication to the origin of the base URL - #123

Merged
GrahamCampbell merged 1 commit into
5.1from
bitbucket-origin-scoped-authentication
Nov 17, 2026
Merged

GrahamCampbell merged 1 commit into
5.1from
bitbucket-origin-scoped-authentication

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Member

The authentication plugin added the Authorization header to every request passing through the client, whatever origin it was for, so the credential followed redirects, pagination links and absolute URLs to other hosts. Bitbucket Cloud answers repository downloads with a redirect to a presigned Amazon S3 URL, and with HTTP clients that leave redirects to the library, such as Guzzle, the token or app password was sent to S3, which rejects the request and repeats the header value in its error body. The plugin is now bound to the origin of the base URL and rebound by setUrl(), adds the header only to requests for that origin, and removes its own header from a request for another origin that already carries it. Redirects within the origin keep the credential, and downloads that redirect to storage now succeed when authenticated. A base URL whose server redirects to another scheme, host or port, most commonly http redirecting to https, is no longer authenticated after the redirect, so such configurations need the URL the server actually uses. Tracked as GHSA-jp92-97q7-5p29.

@GrahamCampbell
GrahamCampbell force-pushed the bitbucket-origin-scoped-authentication branch from 95e6f6b to 4174ae0 Compare November 17, 2026 23:01
@GrahamCampbell
GrahamCampbell marked this pull request as ready for review November 17, 2026 23:04
@GrahamCampbell
GrahamCampbell merged commit ee5f765 into 5.1 Nov 17, 2026
16 checks passed
@GrahamCampbell
GrahamCampbell deleted the bitbucket-origin-scoped-authentication branch November 17, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant