fix(auth/csvauth): don't allow BOTH username and password to be empty

This commit is contained in:
AJ ONeal 2026-02-26 01:52:54 -07:00
parent 3465e9e232
commit 1789c92815
No known key found for this signature in database

View File

@ -358,6 +358,10 @@ func (a *Auth) gcmDecrypt(aes128key [16]byte, gcmNonce [12]byte, derived []byte)
// - the resulting 'user' must match BasicAuthTokenNames ("", "api", and "apikey" are the defaults)
// - then the token is (timing-safe) hashed to check if it exists, and then verified by its algorithm
func (a *Auth) Authenticate(name, secret string) (*Credential, error) {
if name == "" && secret == "" {
return nil, ErrUnauthorized
}
a.mux.Lock()
defer a.mux.Unlock()
c, ok := a.credentials[name]