Tainted flow: 'req' from os.environ.get (line 58, credential/environment) → urllib.request.urlopen (network output)
- Category
- Data Flow
- Confidence
- 97% confidence
- Finding
Sending the environment-provided key to the intended API is legitimate, but this request helper relies on urllib's automatic redirect handling after attaching Authorization. An attacker-influenced API redirect can forward that header to another origin or insecure transport because the destination is not revalidated.
- Content
python headers["Content-Type"] = content_type req = urllib.request.Request(url, data=data, method=method, headers=headers) try: with urllib.request.urlopen(req, timeout=timeout) as resp: return json.loads(resp.read().decode() or "{}") except urllib.error.HTTPError as err: raw = err.read().decode(errors="replace")
