{"record":{"id":"5a57f834a0967260","repo":"kgretzky/evilginx2","slug":"proxy-address-can-t-be-empty","errorCode":null,"errorMessage":"proxy address can't be empty","messagePattern":"proxy address can't be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/http_proxy.go","lineNumber":1917,"sourceCode":"\tp.ip_mtx.Lock()\n\tdefer p.ip_mtx.Unlock()\n\n\tpl := p.getPhishletByPhishHost(hostname)\n\tif pl != nil {\n\t\tsid, ok := p.ip_sids[ip_addr+\"-\"+pl.Name]\n\t\treturn sid, ok\n\t}\n\treturn \"\", false\n}\n\nfunc (p *HttpProxy) setProxy(enabled bool, ptype string, address string, port int, username string, password string) error {\n\tif enabled {\n\t\tptypes := []string{\"http\", \"https\", \"socks5\", \"socks5h\"}\n\t\tif !stringExists(ptype, ptypes) {\n\t\t\treturn fmt.Errorf(\"invalid proxy type selected\")\n\t\t}\n\t\tif len(address) == 0 {\n\t\t\treturn fmt.Errorf(\"proxy address can't be empty\")\n\t\t}\n\t\tif port == 0 {\n\t\t\treturn fmt.Errorf(\"proxy port can't be 0\")\n\t\t}\n\n\t\tu := url.URL{\n\t\t\tScheme: ptype,\n\t\t\tHost:   address + \":\" + strconv.Itoa(port),\n\t\t}\n\n\t\tif strings.HasPrefix(ptype, \"http\") {\n\t\t\tvar dproxy *http_dialer.HttpTunnel\n\t\t\tif username != \"\" {\n\t\t\t\tdproxy = http_dialer.New(&u, http_dialer.WithProxyAuth(http_dialer.AuthBasic(username, password)))\n\t\t\t} else {\n\t\t\t\tdproxy = http_dialer.New(&u)\n\t\t\t}\n\t\t\tp.Proxy.Tr.Dial = dproxy.Dial","sourceCodeStart":1899,"sourceCodeEnd":1935,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/http_proxy.go#L1899-L1935","documentation":"setProxy checks that a non-empty upstream proxy address was provided when the proxy is enabled. An empty address would produce an un-routable proxy URL, so configuration is rejected. This is a required-field validation on the address argument.","triggerScenarios":"Calling setProxy(true, \"socks5\", \"\", port, ...) or running the `proxy` command with the address field omitted/left blank, or a config file where the proxy address key is missing or empty string.","commonSituations":"Copying a proxy config example but forgetting to fill in the host, environment variable for proxy address unset and expanded to empty string, or partial paste of a proxy:port string into the wrong field.","solutions":["Supply the proxy host/IP, e.g. `proxy socks5 127.0.0.1 9050 user pass`","Check that any env var or config key holding the address is actually set and non-empty","If you meant to disable the upstream proxy, pass enabled=false / `proxy off` instead of enabling with a blank address","Ensure address and port were not swapped — port alone won't fill address"],"exampleFix":"// before\np.setProxy(true, \"socks5\", \"\", 9050, \"\", \"\")\n// after\np.setProxy(true, \"socks5\", \"127.0.0.1\", 9050, \"\", \"\")","handlingStrategy":"validation","validationCode":"if enabled && len(address) == 0 {\n    return fmt.Errorf(\"proxy address is required when proxy is enabled\")\n}","typeGuard":"func hasProxyAddress(addr string) bool {\n    return strings.TrimSpace(addr) != \"\"\n}","tryCatchPattern":"if err := proxy.setProxy(true, ptype, addr, port, user, pass); err != nil {\n    if strings.Contains(err.Error(), \"address can't be empty\") {\n        return fmt.Errorf(\"supply upstream proxy host, e.g. 127.0.0.1\")\n    }\n}","preventionTips":["Fill in the address field right after enabling a proxy","Expand env vars and assert they are non-empty before use","Use `proxy off` instead of enabling with blank fields","Keep address and port in the documented order: type, address, port"],"tags":["proxy","configuration","validation"],"backgroundTag":"missing-required-config","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"}