{"record":{"id":"47ba79e2a7147839","repo":"caddyserver/caddy","slug":"base64-decoding-password-v","errorCode":null,"errorMessage":"base64-decoding password: %v","messagePattern":"base64-decoding password: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/caddyauth/basicauth.go","lineNumber":125,"sourceCode":"\t\t}\n\n\t\tacct.Username = repl.ReplaceAll(acct.Username, \"\")\n\t\tacct.Password = repl.ReplaceAll(acct.Password, \"\")\n\n\t\tif acct.Username == \"\" || acct.Password == \"\" {\n\t\t\treturn fmt.Errorf(\"account %d: username and password are required\", i)\n\t\t}\n\n\t\t// TODO: Remove support for redundantly-encoded b64-encoded hashes\n\t\t// Passwords starting with '$' are likely in Modular Crypt Format,\n\t\t// so we don't need to base64 decode them. But historically, we\n\t\t// required redundant base64, so we try to decode it otherwise.\n\t\tif strings.HasPrefix(acct.Password, \"$\") {\n\t\t\tacct.password = []byte(acct.Password)\n\t\t} else {\n\t\t\tacct.password, err = base64.StdEncoding.DecodeString(acct.Password)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"base64-decoding password: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\thba.Accounts[acct.Username] = acct\n\t}\n\thba.AccountList = nil // allow GC to deallocate\n\n\tif hba.HashCache != nil {\n\t\thba.HashCache.cache = make(map[string]bool)\n\t\thba.HashCache.mu = new(sync.RWMutex)\n\t\thba.HashCache.g = new(singleflight.Group)\n\t}\n\n\treturn nil\n}\n\n// Authenticate validates the user credentials in req and returns the user, if valid.\nfunc (hba HTTPBasicAuth) Authenticate(w http.ResponseWriter, req *http.Request) (User, bool, error) {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/caddyauth/basicauth.go#L107-L143","documentation":"Error \"base64-decoding password: %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddyhttp/caddyauth/basicauth.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the password value is valid base64 when base64-encoded passwords are used, or remove the base64 prefix."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}