{"record":{"id":"5346a60757e50013","repo":"kgretzky/evilginx2","slug":"credentials-v","errorCode":null,"errorMessage":"credentials: %v","messagePattern":"credentials: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":606,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"credentials: %v\", err)\n\t}\n\n\tp.password.key, err = regexp.Compile(p.paramVal(*fp.Credentials.Password.Key))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"credentials: %v\", err)\n\t}\n\n\tp.password.search, err = regexp.Compile(p.paramVal(*fp.Credentials.Password.Search))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"credentials: %v\", err)\n\t}\n\n\tp.username.tp = fp.Credentials.Username.Type","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L588-L624","documentation":"Wrapper error for regexp compilation failures of the credentials key/search patterns. After the presence checks pass, each credentials regex is compiled with regexp.Compile and any Go regexp syntax error is wrapped as 'credentials: <compile error>'. Common causes are unbalanced parentheses, stray backslashes, or invalid quantifiers in the YAML regex.","triggerScenarios":"A phishlet's credentials username/password key or search value contains invalid Go RE2 syntax, e.g. '(user' (unclosed group), '*x' (quantifier without operand), or unsupported constructs like backreferences or lookaheads.","commonSituations":"Copying PCRE/JS-style regexes with lookaheads into the phishlet; unescaped special characters like '(' or '+'; missing quotes in YAML causing truncation of the pattern before compilation.","solutions":["Read the wrapped '%v' message to identify the exact regex and syntax error","Fix the regex to valid Go RE2 syntax (no lookaheads/backreferences; escape special chars)","Quote the regex in YAML (single quotes) so special characters survive parsing","Test the regex in a Go-compatible regex tester (RE2) before editing the phishlet"],"exampleFix":"// before (invalid RE2: lookahead)\ncredentials:\n  username:\n    key: 'username(?=.*)'\n    search: 'username=([^&]*)'\n// after\ncredentials:\n  username:\n    key: 'username'\n    search: 'username=([^&]*)'","handlingStrategy":"validation","validationCode":"for _, re := range []string{*uKey, *uSearch, *pKey, *pSearch} {\n  if _, err := regexp.Compile(re); err != nil {\n    return fmt.Errorf(\"credentials regex %q invalid: %v\", re, err)\n  }\n}","typeGuard":"func isValidRegex(s string) bool { _, err := regexp.Compile(s); return err == nil }","tryCatchPattern":null,"preventionTips":["Test all phishlet regexes with an RE2/Go-compatible tester first","Avoid PCRE-only constructs (lookaheads, backreferences)","Quote regex strings in YAML to prevent truncation","Read the wrapped 'credentials: %v' message for the exact syntax fault"],"tags":["phishlet","regex","config","credentials"],"backgroundTag":"invalid-regex-pattern","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"}