-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[6.0] Use bearer auth for binaryTarget
or packages from a package registry
#7670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…kage registry (swiftlang#7662) Use bearer auth when pulling binary targets or a package from a package registry and the user is `token`. ### Motivation: When logging in to a package registry bearer auth works. However when fetching binaryTargets or pulling packages from a registry basic auth is used always. This either breaks services that don't use basic auth or leads to nasty workarounds like first creating a netrc file with "token" as the user and after login changing the user back to the actual user. Assuming that basic auth is allowed with an identiy token. ### Modifications: Check if the user is `token` when creating the authorization header and use Bearer auth in these cases. ### Result: When the user is `token` the `Authorization` header will be set to `Bearer {{access_token}}` instead of `Basic token:{{access_token}}`. Before: <img width="698" alt="Screenshot 2024-06-13 at 22 49 08" src="https://github.com/apple/swift-package-manager/assets/13999931/0f3eef32-55e3-417f-b129-c138ca452b08"> After: <img width="699" alt="Screenshot 2024-06-13 at 22 48 38" src="https://github.com/apple/swift-package-manager/assets/13999931/d98daaa7-1535-40d0-96ea-a6736f5d1e3e">
@pwallrich On a second read, would you be able to point out a place in either the registry spec or any bearer auth specs that specify that |
I assume it's this registry auth SE subsection, but waiting for a review from the SE author on the original PR to confirm that the behavior is correct. |
binaryTarget
or packages from a package registry
So the i.E
Fetching packages from the package-registry works, since the package-registry uses the configuration to decide whether Bearer or Basic Auth should be used. If you try to pull a So basically the issue is that Sidenote: |
I think I've merged the original PR on |
Closing, as this is reverted on |
Explanation: Use bearer auth when pulling binary targets or a package from a package registry and the user is
token
. The issue is thatpackage-registry
andbinaryArtifact
have an auth logic that behaves differently.Scope: Authorization Header generation when pulling dependencies
Original PR: #7662
Risk: Users named
token
can't use basic auth anymoreTesting: Unit Test for testing correct Auth Header is generated
Reviewer: @MaxDesiatov