Currently, source-controller does not accept a secret with no username as credential for HTTP Basic Authentication :
|
// BasicAuthFromSecret attempts to construct a basic auth getter.Option for the |
|
// given v1.Secret and returns the result. |
|
// |
|
// Secrets with no username AND password are ignored, if only one is defined it |
|
// returns an error. |
|
func BasicAuthFromSecret(secret corev1.Secret) (getter.Option, error) { |
|
username, password := string(secret.Data["username"]), string(secret.Data["password"]) |
|
switch { |
|
case username == "" && password == "": |
|
return nil, nil |
|
case username == "" || password == "": |
|
return nil, fmt.Errorf("invalid '%s' secret data: required fields 'username' and 'password'", secret.Name) |
|
} |
|
return getter.WithBasicAuth(username, password), nil |
|
} |
However, HTTP Basic Authentication protocol permit having no username, e.g. :password, which would be Basic OnBhc3N3b3Jk.
I propose accepting a secret with just the password field.
Currently, source-controller does not accept a secret with no username as credential for HTTP Basic Authentication :
source-controller/internal/helm/getter/getter.go
Lines 43 to 57 in 3cbb89d
However, HTTP Basic Authentication protocol permit having no username, e.g.
:password, which would beBasic OnBhc3N3b3Jk.I propose accepting a secret with just the password field.