Tainted flow: 'req' from os.environ.get (line 28, credential/environment) → urllib.request.urlopen (network output)
Critical
- Category
- Data Flow
- Content
url += "?" + urllib.parse.urlencode({"modelType": args.type}) req = urllib.request.Request(url, headers={"Authorization": f"Bearer {key}", "Accept": "application/json"}) try: with urllib.request.urlopen(req, timeout=30) as resp: data = json.load(resp) except Exception as exc: raise SystemExit(f"模型查询失败:{exc}") from exc- Confidence
- 81% confidence
- Finding
- The request sent to urlopen includes a bearer token sourced from an environment variable, and the destination base URL is also overrideable via AI_HIVE_BASE_URL. If that environment variable is manipulated, the script will transmit the secret API key to an attacker-controlled endpoint, creating a real credential exfiltration/SSRF-style risk despite the code's otherwise legitimate purpose.
