Add support for bearer token auth with Composer registries#28
Add support for bearer token auth with Composer registries#28JamieMagee merged 2 commits intodependabot:mainfrom
Conversation
| @@ -92,7 +94,11 @@ func (h *ComposerHandler) HandleRequest(req *http.Request, ctx *goproxy.ProxyCtx | |||
| } | |||
|
|
|||
| logging.RequestLogf(ctx, "* authenticating composer registry request (host: %s)", req.URL.Hostname()) | |||
There was a problem hiding this comment.
The log message doesn't distinguish between bearer and basic auth. The NPM handler does this (host: %s, basic auth) vs (host: %s, token auth), and it's genuinely useful when debugging why a registry is rejecting credentials. Could you split the log line so it says which auth method is being used?
|
Thanks for this change! Other than the log message, this looks good.
Nope, shouldn't be needed. The original architecture passed credentials directly to |
|
I'm trying to get this running now, with the following config: But I'm getting the following error message:
I couldn't find where the schema for the config is defined, do we need to update it, too, to support Or is perhaps my config wrong? :D |
|
I don't think it will be deployed immediately. |

This PR follows from the discussion at dependabot/dependabot-core#12946.
Some composer registries, ex.
packages.shopware.com, only support Bearer authentication. Dependabot currently only supports Basic Auth.I have added a
tokenfield to the credentials which takes precedence over basic auth when a token is set and not empty.The added tests all run on my machine, and I have tested my changes using
dependabot/cliwith the following configuration:I ran it with a locally built image of the proxy as follows:
#!/bin/bash dependabot update \ --proxy-image dependabot-proxy-local:dev \ -f config.ymlThe log output shows that authentication has worked for
packages.shopware.com:Disclaimer: My experience with Go is somewhat limited, so if there are more idiomatic ways to solve things, I'd be happy to learn! Also, I've seen a few places in
dependabot-corewhere Composer uses basic auth. I'm unsure if we should add token support there, too? If that's the case, I'd be happy so work on a PR.