{"record":{"id":"064715836eb9c48f","repo":"kgretzky/evilginx2","slug":"credentials-missing-username-key-field","errorCode":null,"errorMessage":"credentials: missing username `key` field","messagePattern":"credentials: missing username `key` field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":592,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'header' not found for http auth token\")\n\t\t\t}\n\n\t\t\terr := p.addHttpAuthToken(p.paramVal(*at.Domain), p.paramVal(*at.Path), p.paramVal(*at.Name), p.paramVal(*at.Header))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor _, au := range fp.AuthUrls {\n\t\tre, err := regexp.Compile(p.paramVal(au))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.authUrls = append(p.authUrls, re)\n\t}\n\n\tif fp.Credentials.Username.Key == nil {\n\t\treturn fmt.Errorf(\"credentials: missing username `key` field\")\n\t}\n\tif fp.Credentials.Username.Search == nil {\n\t\treturn fmt.Errorf(\"credentials: missing username `search` field\")\n\t}\n\tif fp.Credentials.Password.Key == nil {\n\t\treturn fmt.Errorf(\"credentials: missing password `key` field\")\n\t}\n\tif fp.Credentials.Password.Search == nil {\n\t\treturn fmt.Errorf(\"credentials: missing password `search` field\")\n\t}\n\n\tp.username.key, err = regexp.Compile(p.paramVal(*fp.Credentials.Username.Key))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"credentials: %v\", err)\n\t}\n\n\tp.username.search, err = regexp.Compile(p.paramVal(*fp.Credentials.Username.Search))\n\tif err != nil {","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L574-L610","documentation":"Thrown while validating the credentials section of a phishlet: fp.Credentials.Username.Key is nil. Every phishlet must declare how to identify the username input ('key' is the regex matching the input field name/id), and it is missing. The phishlet fails to load.","triggerScenarios":"Loading a phishlet whose credentials.username block lacks 'key', or whose YAML structure puts username fields at the wrong nesting level under credentials.","commonSituations":"Minimal/hand-written phishlet missing the username block; indentation error detaching 'key' from 'username'; migrating an old phishlet format missing this field.","solutions":["Add 'username: { key: <regex>, search: <regex> }' under credentials in the phishlet YAML","Ensure 'key' is indented under credentials.username, not a sibling of it","Copy the credentials block from a known-good example phishlet"],"exampleFix":"// before\ncredentials:\n  username:\n    search: 'user=([^&]*)'\n// after\ncredentials:\n  username:\n    key: 'username'\n    search: 'user=([^&]*)'","handlingStrategy":"validation","validationCode":"if cfg.Credentials.Username.Key == nil || *cfg.Credentials.Username.Key == \"\" {\n  return errors.New(\"credentials: missing username key\")\n}","typeGuard":"func hasUsernameKey(fp FakePost) bool { return fp.Credentials.Username.Key != nil && *fp.Credentials.Username.Key != \"\" }","tryCatchPattern":null,"preventionTips":["Always define both username and password blocks with key+search","Copy the credentials block from a known-good phishlet","Lint YAML nesting under credentials"],"tags":["phishlet","config","credentials","validation"],"backgroundTag":"phishlet-schema-validation","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}