Tainted flow: 'req' from os.environ.get (line 221, credential/environment) → urllib.request.urlopen (network output)
- Category
- Data Flow
- Confidence
- 95% confidence
- Finding
The request target is derived from environment-controlled configuration (BASE_URL), and the code automatically obtains and then uses API credentials against that endpoint. If an attacker can influence environment variables, they can redirect requests to a malicious server and capture the PATENTMAX_API_KEY or trial key, as well as uploaded patent materials. In this skill, the transmitted content is highly sensitive IP/disclosure data, which raises the severity.
- Content
python req.add_header("Content-Type", "application/json") req.add_header("Accept", "application/json") try: with urllib.request.urlopen(req, timeout=30) as response: payload = json.loads(response.read().decode("utf-8")) except urllib.error.HTTPError as exc: _, message = _server_error(exc.read().decode("utf-8", "replace"))
