{"record":{"id":"5a1dd099752e13de","repo":"sundowndev/phoneinfoga","slug":"search-engine-id-and-or-api-key-is-not-defined","errorCode":null,"errorMessage":"search engine ID and/or API key is not defined","messagePattern":"search engine ID and/or API key is not defined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/remote/googlecse_scanner.go","lineNumber":68,"sourceCode":"\t}\n\n\treturn &googleCSEScanner{\n\t\tMaxResults: int64(maxResults),\n\t\thttpClient: HTTPclient,\n\t}\n}\n\nfunc (s *googleCSEScanner) Name() string {\n\treturn GoogleCSE\n}\n\nfunc (s *googleCSEScanner) Description() string {\n\treturn \"Googlecse searches for footprints of a given phone number on the web using Google Custom Search Engine.\"\n}\n\nfunc (s *googleCSEScanner) DryRun(_ number.Number, opts ScannerOptions) error {\n\tif opts.GetStringEnv(\"GOOGLECSE_CX\") == \"\" || opts.GetStringEnv(\"GOOGLE_API_KEY\") == \"\" {\n\t\treturn errors.New(\"search engine ID and/or API key is not defined\")\n\t}\n\treturn nil\n}\n\nfunc (s *googleCSEScanner) Run(n number.Number, opts ScannerOptions) (interface{}, error) {\n\tvar allItems []*customsearch.Result\n\tvar dorks []*GoogleSearchDork\n\tvar totalResultCount int\n\tvar totalRequestCount int\n\tvar cx = opts.GetStringEnv(\"GOOGLECSE_CX\")\n\tvar apikey = opts.GetStringEnv(\"GOOGLE_API_KEY\")\n\n\tdorks = append(dorks, s.generateDorkQueries(n)...)\n\n\tcustomsearchService, err := customsearch.NewService(\n\t\tcontext.Background(),\n\t\toption.WithAPIKey(apikey),\n\t\toption.WithHTTPClient(s.httpClient),","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/sundowndev/phoneinfoga/blob/55807b05b753dab7bc6fe67403ca385668dda179/lib/remote/googlecse_scanner.go#L50-L86","documentation":"The Google Custom Search scanner's DryRun checks that both GOOGLECSE_CX (search engine ID) and GOOGLE_API_KEY are set in the environment; if either is empty it returns 'search engine ID and/or API key is not defined' and the scanner is skipped.","triggerScenarios":"Running a scan that includes the googlecse scanner when either GOOGLECSE_CX or GOOGLE_API_KEY is unset or an empty string in the environment passed via ScannerOptions.GetStringEnv.","commonSituations":"Credentials file not sourced in the shell, running inside Docker/systemd/CI where env vars were not forwarded, typo in variable name, or having an API key but never creating a Google Custom Search Engine (so no CX ID).","solutions":["Export both GOOGLECSE_CX and GOOGLE_API_KEY before running the scan (e.g. in .env or shell profile)","Verify with `echo $GOOGLECSE_CX $GOOGLE_API_KEY` that both are non-empty in the same shell/session that runs the tool","If you do not want this scanner, disable it explicitly instead of relying on missing creds"],"exampleFix":"// before\nscan --number +14155552671   # GOOGLE_API_KEY unset\n// after\nexport GOOGLECSE_CX=017576662512468239146:omuauf_lfve\nexport GOOGLE_API_KEY=AIzaSy...\nscan --number +14155552671","handlingStrategy":"validation","validationCode":"for v in GOOGLECSE_CX GOOGLE_API_KEY; do\n  [ -n \"${!v}\" ] || echo \"missing $v\" >&2\ndone\n// Go equivalent:\nif os.Getenv(\"GOOGLECSE_CX\") == \"\" || os.Getenv(\"GOOGLE_API_KEY\") == \"\" {\n    return errors.New(\"googlecse scanner requires GOOGLECSE_CX and GOOGLE_API_KEY\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep all API credentials in one sourced .env file and load it in every shell/CI job","Use docker --env-file or CI secret injection so vars reach the process","Smoke-test with a DryRun before long scans","Name variables exactly as documented: GOOGLECSE_CX and GOOGLE_API_KEY"],"tags":["google-cse","env-var","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"55807b05b753dab7bc6fe67403ca385668dda179","analyzedAt":"2026-09-03T13:37:27.908Z","contentChangedAt":"2026-09-03T13:37:27.908Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}