goharbor/harbor · error · errs.baseError

10011

10011

Error message

header '%s' missing

What it means

Auth failure in SecretAuthenticator.DoAuth: the request is missing the secret authorization header entirely (or it is blank), so the job service API call cannot be authenticated.

Solutions

  1. Include the required Authorization header with the jobservice secret
  2. Check the client is configured with the correct shared secret
  3. Verify proxies/gateways are not stripping the header
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/jobservice/api/authenticator.go:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/be9cc058081033c6. Report an issue: GitHub.

Appendix: source

Thrown at src/jobservice/api/authenticator.go:56

	//
	// Returns:
	// nil returned if successfully done
	// otherwise an error returned
	DoAuth(req *http.Request) error
}

// SecretAuthenticator implements interface 'Authenticator' based on simple secret.
type SecretAuthenticator struct{}

// DoAuth implements same method in interface 'Authenticator'.
func (sa *SecretAuthenticator) DoAuth(req *http.Request) error {
	if req == nil {
		return errors.New("nil request")
	}

	h := strings.TrimSpace(req.Header.Get(authHeader))
	if utils.IsEmptyStr(h) {
		return fmt.Errorf("header '%s' missing", authHeader)
	}

	if !strings.HasPrefix(h, secretPrefix) {
		return fmt.Errorf("'%s' should start with '%s'", authHeader, secretPrefix)
	}

	secret := strings.TrimSpace(strings.TrimPrefix(h, secretPrefix))
	// incase both two are empty
	if utils.IsEmptyStr(secret) {
		return errors.New("empty secret is not allowed")
	}

	expectedSecret := config.GetUIAuthSecret()
	if subtle.ConstantTimeCompare([]byte(expectedSecret), []byte(secret)) == 0 {
		return errors.New("unauthorized")
	}

	return nil

View on GitHub (pinned to 7b2fd08cc5)