{"record":{"id":"5e27f2d58ac2ad27","repo":"kgretzky/evilginx2","slug":"intercept-path-invalid-regular-expression-v","errorCode":null,"errorMessage":"intercept: `path` invalid regular expression: %v","messagePattern":"intercept: `path` invalid regular expression: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":504,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\tif fp.Intercept != nil {\n\t\tfor _, ic := range *fp.Intercept {\n\t\t\tvar err error\n\t\t\tvar body, mime string\n\t\t\tif ic.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"intercept: missing `domain` field\")\n\t\t\t}\n\t\t\tif *ic.Domain == \"\" {\n\t\t\t\treturn fmt.Errorf(\"intercept: `domain` field cannot be empty\")\n\t\t\t}\n\t\t\tif ic.Path == nil {\n\t\t\t\treturn fmt.Errorf(\"intercept: missing `path` field\")\n\t\t\t}\n\t\t\tpath_re, err := regexp.Compile(*ic.Path)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"intercept: `path` invalid regular expression: %v\", err)\n\t\t\t}\n\t\t\tif ic.HttpStatus == nil {\n\t\t\t\treturn fmt.Errorf(\"intercept: missing `http_status` field\")\n\t\t\t}\n\t\t\tif ic.Body != nil {\n\t\t\t\tbody = *ic.Body\n\t\t\t}\n\t\t\tif ic.Mime != nil {\n\t\t\t\tmime = *ic.Mime\n\t\t\t}\n\t\t\terr = p.addIntercept(*ic.Domain, path_re, *ic.HttpStatus, body, mime)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor _, at := range *fp.AuthTokens {\n\t\tttype := \"cookie\"","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L486-L522","documentation":"This error is thrown when the `path` field of an `intercept` block in a phishlet fails to compile as a Go regular expression (regexp.Compile returns an error). The `%v` is appended with the underlying regexp parse error, e.g. unclosed group or invalid escape. The phishlet is rejected at load time.","triggerScenarios":"An intercept block's `path` value contains an invalid regex, such as `path: ^/login(` (unclosed group), a trailing backslash, or Go-RE2-unsupported syntax like lookahead `(?=...)`.","commonSituations":"Hand-written regexes with unbalanced parentheses/brackets; copying regexes from PCRE/JS sources using lookaheads; unquoted YAML strings whose special characters are truncated by the parser.","solutions":["Fix the regular expression in the `path` field, using the exact error text appended to the message to locate the syntax problem.","Test the regex against Go's RE2 syntax (no lookaheads/lookbehinds); rewrite patterns that use them (e.g. use `[^/]*` instead of `(?!...)`).","Quote the YAML value (single quotes) so special regex characters are not consumed by the YAML parser."],"exampleFix":"// before (phishlet.yml)\nintercept:\n  - domain: accounts\n    path: ^/login(?=\\?next)\n// after (RE2 has no lookahead)\nintercept:\n  - domain: accounts\n    path: '^/login\\?.*next.*'","handlingStrategy":"validation","validationCode":"import \"regexp\"\n\nfor i, ic := range cfg.Intercept {\n    if ic.Path == nil {\n        continue\n    }\n    if _, err := regexp.Compile(*ic.Path); err != nil {\n        return fmt.Errorf(\"intercept[%d]: `path` invalid regex: %v\", i, err)\n    }\n}","typeGuard":"func isValidRE2Pattern(p string) bool {\n    _, err := regexp.Compile(p)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Test regexes in a Go/RE2 playground before putting them in the phishlet.","Avoid PCRE-only constructs (lookaheads, lookbehinds, backreferences) — RE2 does not support them.","Quote YAML regex values with single quotes to protect special characters.","Prefer simple anchored patterns like ^/exact/path$."],"tags":["phishlet","configuration","regex","yaml-validation"],"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"}