Tainted flow: 'req' from os.environ.get (line 40, credential/environment) → urllib.request.urlopen (network output)
- Category
- Data Flow
- Confidence
- 98% confidence
- Finding
Sending the provider token to the configured provider is legitimate, but urllib.request.urlopen follows redirects by default and can forward the custom X-Auth-Tenant-Token header to a different origin. A malicious or compromised redirect response could therefore disclose the account token, making this a conditional credential-leak vulnerability rather than evidence of intentional exfiltration.
- Content
python headers = {"User-Agent": USER_AGENT, "X-Auth-Tenant-Token": token, "Accept": "application/json"} req = urllib.request.Request(BASE_URL + path, headers=headers, method="GET") try: with urllib.request.urlopen(req, timeout=timeout) as response: return response.status, _decode_json(response.read()) except urllib.error.HTTPError as exc: return exc.code, _decode_json(exc.read())
