Tainted flow: 'req' from os.environ.get (line 88, credential/environment) → urllib.request.urlopen (network output)
- Category
- Data Flow
- Confidence
- 94% confidence
- Finding
The request target is derived from an environment-controlled base URL, and the function may attach the machine API key before sending the request. If an attacker can influence COINTELLIGENCE_BASE_URL, the script can be redirected to an arbitrary host and exfiltrate credentials or registration traffic, which is a real SSRF/credential-leak risk in agent or CI environments where environment variables are mutable.
- Content
python headers["x-api-key"] = api_key req = urllib.request.Request(BASE_URL + path, data=data, headers=headers, method=method) try: with urllib.request.urlopen(req, timeout=20) as res: body = res.read().decode("utf-8") return json.loads(body) if body else {} except urllib.error.HTTPError as exc:
