{"record":{"id":"f6765a4d2cdee07b","repo":"kgretzky/evilginx2","slug":"auth-tokens-domain-not-found-for-body-auth-toke","errorCode":null,"errorMessage":"auth_tokens: 'domain' not found for body auth token","messagePattern":"auth_tokens: 'domain' not found for body auth token","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":547,"sourceCode":"\t\tswitch ttype {\n\t\tcase \"cookie\":\n\t\t\tif at.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'domain' not found for cookie auth token\")\n\t\t\t}\n\t\t\tif at.Keys == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'keys' not found for cookie auth token\")\n\t\t\t}\n\n\t\t\tfor n := range *at.Keys {\n\t\t\t\t(*at.Keys)[n] = p.paramVal((*at.Keys)[n])\n\t\t\t}\n\t\t\terr := p.addCookieAuthTokens(p.paramVal(*at.Domain), *at.Keys)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"body\":\n\t\t\tif at.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'domain' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Path == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'path' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Name == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'name' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Search == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'search' not found for body auth token\")\n\t\t\t}\n\n\t\t\terr := p.addBodyAuthToken(p.paramVal(*at.Domain), p.paramVal(*at.Path), p.paramVal(*at.Name), p.paramVal(*at.Search))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"http\":\n\t\t\tif at.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'domain' not found for http auth token\")","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L529-L565","documentation":"This error is thrown when a `body`-type entry in a phishlet's `auth_tokens` section lacks the required `domain` field. Body auth tokens are extracted from HTTP response bodies and still need a domain to scope where the token is captured. The phishlet is rejected at load time.","triggerScenarios":"An auth_tokens entry with `type: body` defines `path`, `name`, and/or `search` but omits the `domain:` key.","commonSituations":"Copying a body token entry from an example and deleting domain by accident; assuming body tokens do not need a domain; mis-indented YAML placing domain in a sibling entry.","solutions":["Add a `domain` field to the body auth token entry (e.g. `domain: api`).","Use a wildcard domain if the token can originate from any subdomain, per the phishlet format rules.","Check YAML indentation to ensure `domain` is a child of the same list item as the body token's other fields."],"exampleFix":"// before (phishlet.yml)\nauth_tokens:\n  - type: body\n    path: ^/api/session$\n    name: token\n    search: 'token=([A-Za-z0-9]+)'\n// after\nauth_tokens:\n  - type: body\n    domain: api\n    path: ^/api/session$\n    name: token\n    search: 'token=([A-Za-z0-9]+)'","handlingStrategy":"validation","validationCode":"for i, at := range cfg.AuthTokens {\n    if at.Type != nil && *at.Type == \"body\" && at.Domain == nil {\n        return fmt.Errorf(\"auth_tokens[%d]: 'domain' not found for body auth token\", i)\n    }\n}","typeGuard":"func bodyTokenHasDomain(at AuthToken) bool {\n    return at.Type != nil && *at.Type == \"body\" && at.Domain != nil\n}","tryCatchPattern":null,"preventionTips":["Remember body tokens require domain even though the token comes from a response body.","Fill in all four fields (domain, path, name, search) at once when authoring body tokens.","Validate with a schema checker before loading the phishlet."],"tags":["phishlet","configuration","auth-tokens","yaml-validation"],"backgroundTag":"missing-required-argument","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"}