{"record":{"id":"a5b0d3d9162e4cff","repo":"kgretzky/evilginx2","slug":"login-domain-field-cannot-be-empty","errorCode":null,"errorMessage":"login: `domain` field cannot be empty","messagePattern":"login: `domain` field cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":643,"sourceCode":"\tif p.username.tp == \"\" {\n\t\tp.username.tp = \"post\"\n\t}\n\tp.password.tp = fp.Credentials.Password.Type\n\tif p.password.tp == \"\" {\n\t\tp.password.tp = \"post\"\n\t}\n\tp.username.key_s = p.paramVal(*fp.Credentials.Username.Key)\n\tp.password.key_s = p.paramVal(*fp.Credentials.Password.Key)\n\n\tif fp.LoginItem.Domain == nil {\n\t\treturn fmt.Errorf(\"login: missing `domain` field\")\n\t}\n\tif fp.LoginItem.Path == nil {\n\t\treturn fmt.Errorf(\"login: missing `path` field\")\n\t}\n\tp.login.domain = p.paramVal(*fp.LoginItem.Domain)\n\tif p.login.domain == \"\" {\n\t\treturn fmt.Errorf(\"login: `domain` field cannot be empty\")\n\t}\n\tlogin_domain_ok := false\n\tfor _, h := range p.proxyHosts {\n\t\tvar check_host string\n\t\tif h.orig_subdomain != \"\" {\n\t\t\tcheck_host = h.orig_subdomain + \".\"\n\t\t}\n\t\tcheck_host += h.domain\n\t\tif strings.ToLower(check_host) == strings.ToLower(p.login.domain) {\n\t\t\tlogin_domain_ok = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !login_domain_ok {\n\t\treturn fmt.Errorf(\"login: `domain` must contain a value of one of the hostnames (`orig_subdomain` + `domain`) defined in `proxy_hosts` section\")\n\t}\n\n\tp.login.path = p.paramVal(*fp.LoginItem.Path)","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L625-L661","documentation":"After reading `login.domain`, phishlet loading verifies it equals one of the hostnames built from the `proxy_hosts` entries (`orig_subdomain` + \".\" + `domain`, case-insensitive). An empty `login.domain` value fails this cross-check and aborts loading.","triggerScenarios":"Phishlet YAML with `login:` `domain: \"\"` (or `domain:` with no value) — the key exists but paramVal resolves it to an empty string.","commonSituations":"Author leaving a placeholder blank intending to fill it later; environment variable/param substitution (`{...}` placeholders) resolving to empty because the phishlet parameter was not provided.","solutions":["Set `login.domain` to the full original hostname, e.g. `accounts.example.com`, matching a proxy_hosts entry.","Confirm the phishlet's parameters (if `domain` uses `{param}` substitution) are supplied and non-empty.","Ensure the value matches exactly one of `orig_subdomain.domain` combinations spelled in proxy_hosts.","Reload the phishlet to continue validation."],"exampleFix":"// before\nproxy_hosts:\n  - phish_sub: acct\n    orig_sub: accounts\n    domain: example.com\nlogin:\n  domain: ''\n// after\nlogin:\n  domain: accounts.example.com","handlingStrategy":"validation","validationCode":"d := strings.ToLower(pl.Login.Domain)\nok := false\nfor _, h := range pl.ProxyHosts {\n    if strings.ToLower(h.OrigSubdomain+\".\"+h.Domain) == d { ok = true; break }\n}\nif pl.Login.Domain == \"\" || !ok {\n    return errors.New(\"login.domain empty or not among proxy_hosts hostnames\")\n}","typeGuard":"func loginDomainMatches(l *LoginItem, hosts []ProxyHost) bool {\n    if l == nil || l.Domain == nil || *l.Domain == \"\" { return false }\n    for _, h := range hosts {\n        if strings.EqualFold(h.OrigSubdomain+\".\"+h.Domain, *l.Domain) { return true }\n    }\n    return false\n}","tryCatchPattern":"if err := pl.Load(cfg); err != nil {\n    if strings.Contains(err.Error(), \"cannot be empty\") {\n        log.Printf(\"set login.domain for %s to orig_sub.domain of a proxy_host\", pl.Name)\n    }\n}","preventionTips":["Fill in all placeholder values before shipping a phishlet.","Ensure any {param} placeholders in domain resolve to non-empty values.","Cross-check login.domain against every proxy_hosts entry.","Automate a hostname cross-check script over your phishlet collection."],"tags":["configuration","phishlet","validation","hostname"],"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-12T22:17:10.623Z"}