{"record":{"id":"3a1a674133444dcc","repo":"owasp-amass/amass","slug":"no-api-key-found","errorCode":null,"errorMessage":"no API key found","messagePattern":"no API key found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/support/support.go","lineNumber":118,"sourceCode":"\tnow := time.Now()\n\n\tif matches, err := c.CheckTransformations(from, to, plugin); err == nil && matches != nil {\n\t\tif ttl := matches.TTL(plugin); ttl >= 0 {\n\t\t\treturn now.Add(time.Duration(-ttl) * time.Minute), nil\n\t\t}\n\t\tif ttl := matches.TTL(to); ttl >= 0 {\n\t\t\treturn now.Add(time.Duration(-ttl) * time.Minute), nil\n\t\t}\n\t}\n\n\treturn time.Time{}, fmt.Errorf(\"failed to obtain the TTL for transformation %s->%s\", from, to)\n}\n\nfunc GetAPI(name string, e *et.Event) (string, error) {\n\t// TODO: Add support for multiple API keys\n\tdsc := e.Session.Config().GetDataSourceConfig(name)\n\tif dsc == nil || len(dsc.Creds) == 0 {\n\t\treturn \"\", errors.New(\"no API key found\")\n\t}\n\n\tfor _, cred := range dsc.Creds {\n\t\tif cred != nil && cred.Apikey != \"\" {\n\t\t\treturn cred.Apikey, nil\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"no API key found\")\n}\n\nfunc IPNetblock(session et.Session, addrstr string) *sessions.CIDRangerEntry {\n\tip := net.ParseIP(addrstr)\n\tif ip == nil {\n\t\treturn nil\n\t}\n\n\tentries, err := session.CIDRanger().ContainingNetworks(ip)","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/support/support.go#L100-L136","documentation":"GetAPI in engine/plugins/support/support.go returns errors.New(\"no API key found\") when the data source named by the first argument has no configuration entry (GetDataSourceConfig returns nil) or its config contains zero credentials. The library requires an API key to use the corresponding data-source plugin and refuses to proceed without one.","triggerScenarios":"Calling support.GetAPI(name, event) where e.Session.Config().GetDataSourceConfig(name) returns nil (source not configured) or dsc.Creds is empty — i.e. the plugin's data source was never given credentials in the config.","commonSituations":"Running the tool without a config file specifying API keys for paid data sources; config key name mismatch (source configured under a different name than the plugin expects); credentials present but not loaded from the environment/file.","solutions":["Add the data source configuration with at least one credential entry (with apikey) to the session config.","Verify the data source name passed to GetAPI matches the name used in the config file.","Confirm the config file is actually loaded by the session before enumeration starts.","Obtain a valid API key from the provider and place it under the source's creds.apikey field."],"exampleFix":"// before (config)\n// (no entry for the source)\n// after (YAML config)\ndata_sources:\n  bgptools:\n    creds:\n      - apikey: \"YOUR_API_KEY\"","handlingStrategy":"validation","validationCode":"// Go: verify the source is configured before calling GetAPI\ndsc := session.Config().GetDataSourceConfig(\"bgptools\")\nif dsc == nil || len(dsc.Creds) == 0 {\n    log.Fatal(\"configure credentials for bgptools before running\")\n}","typeGuard":"func hasAPIKey(session et.Session, name string) bool {\n    dsc := session.Config().GetDataSourceConfig(name)\n    return dsc != nil && len(dsc.Creds) > 0\n}","tryCatchPattern":"key, err := support.GetAPI(\"bgptools\", event)\nif err != nil {\n    log.Warn(\"source disabled: \", err.Error())\n    return nil // skip this data source\n}","preventionTips":["Declare all required API keys in the config file before scanning.","Keep data source names in config identical to plugin names.","Load apikeys from environment variables and fail fast when unset.","Document which data sources are mandatory vs optional."],"tags":["api-key","config","authentication"],"backgroundTag":"missing-api-key","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}