{"record":{"id":"17af4cea79354426","repo":"kgretzky/evilginx2","slug":"force-post-missing-search-key-field","errorCode":null,"errorMessage":"force_post: missing search `key` field","messagePattern":"force_post: missing search `key` field","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":719,"sourceCode":"\t\t\t}\n\t\t\tif op.Type == nil || *op.Type != \"post\" {\n\t\t\t\treturn fmt.Errorf(\"force_post: unknown type - only 'post' is currently supported\")\n\t\t\t}\n\t\t\tif op.Force == nil || len(*op.Force) == 0 {\n\t\t\t\treturn fmt.Errorf(\"force_post: missing or empty `force` field\")\n\t\t\t}\n\n\t\t\tfpf := ForcePost{}\n\t\t\tfpf.path, err = regexp.Compile(p.paramVal(*op.Path))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfpf.tp = *op.Type\n\n\t\t\tif op.Search != nil {\n\t\t\t\tfor _, op_s := range *op.Search {\n\t\t\t\t\tif op_s.Key == nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"force_post: missing search `key` field\")\n\t\t\t\t\t}\n\t\t\t\t\tif op_s.Search == nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"force_post: missing search `search` field\")\n\t\t\t\t\t}\n\n\t\t\t\t\tf_s := ForcePostSearch{}\n\t\t\t\t\tf_s.key, err = regexp.Compile(p.paramVal(*op_s.Key))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tf_s.search, err = regexp.Compile(p.paramVal(*op_s.Search))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfpf.search = append(fpf.search, f_s)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, op_f := range *op.Force {","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L701-L737","documentation":"Thrown when an optional `search` entry inside a force_post operation lacks the `key` field. Each search entry needs both a `key` (compiled into a regexp after param substitution) and a `search` regexp; without `key` the entry is meaningless and validation fails. The key identifies which POST parameter is being searched.","triggerScenarios":"Phishlet YAML has a force_post `search:` list item without a `key:` key, e.g. only `search:` and `regexp`-style fields are present; validation via p.Validate().","commonSituations":"Typos (`name:` instead of `key:`); copying search blocks from regex_sub or subfilters that use different field names; partial edits leaving half-finished search entries.","solutions":["Add the missing `key:` field to each force_post search entry","Fix key-name typos to match the force_post search schema (key + search)","Remove incomplete search entries if they are not needed"],"exampleFix":"# before\nforce_post:\n  - path: '/login'\n    type: post\n    search:\n      - search: 'password'\n# after\nforce_post:\n  - path: '/login'\n    type: post\n    search:\n      - key: 'password'\n        search: 'password'","handlingStrategy":"validation","validationCode":"for _, op := range forcePosts {\n    if op.Search == nil { continue }\n    for j, s := range *op.Search {\n        if s.Key == nil {\n            return fmt.Errorf(\"force_post search[%d]: `key` is required\", j)\n        }\n    }\n}","typeGuard":"func searchHasKey(s ForcePostSearch) bool { return s.Key != nil }","tryCatchPattern":null,"preventionTips":["Ensure every search entry has both `key` and `search` fields","Do not mix field names from regex_sub/subfilters into force_post search","Lint phishlet YAML before deployment","Remove unfinished search entries before saving"],"tags":["phishlet","config-validation","force-post"],"backgroundTag":"phishlet-config-validation","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}