bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.74k stars 3.99k forks source link

allow multiple credential helpers for a single site #22933

Open peakschris opened 2 weeks ago

peakschris commented 2 weeks ago

Description of the feature request:

I have two different sets of credentials for two different subdirectories of a site:

my.site.com/sub1 <- credentials A my.site.com/sub2 <- credentials B

the credential helper works great for specifying one set of credentials, but is specified not to consider the subdirectory in the scope.

I would like to be able to do this:

common --credential_helper=my.site.com/sub1=sub1_credentials.bat
common --credential_helper=my.site.com/sub2=sub2_credentials.bat

But I get:

ERROR: While parsing option --credential_helper=my.site.com/sub1=sub1_credentials.bat: Credential helper scope 'my.site.com/sub1' must be a valid domain name with an optional leading '*.' wildcard

Which category does this issue belong to?

Configurability

What underlying problem are you trying to solve with this feature?

Connecting to websites such as github, typically different tokens can be assigned for different subdirectories on the main site.

Which operating system are you running Bazel on?

windows

What is the output of bazel info release?

bazel 7.2.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

peakschris commented 2 weeks ago

@Yannic this may interest you

peakschris commented 2 weeks ago

Another option would be to follow docker's protocol, https://github.com/docker/docker-credential-helpers?tab=readme-ov-file#development; the URL is supplied to the credential helper, which can then return the appropriate auth.

tjgq commented 2 weeks ago

the URL is supplied to the credential helper, which can then return the appropriate auth

This is already the case. The standard input to a credential helper is a JSON object with a uri key.