[medium] semgrep: Server-side request forgery (SSRF) #913

Closed
opened 2026-11-05 20:13:37 +00:00 by pruefwerk · 1 comment
Member

medium Finding

Scanner: semgrep
Severity: medium
Rule: gitlab-python_urlopen_rule-urllib-urlopen
CWE: CWE-918

Description

The application was found passing in a non-literal value to the urllib methods which issue
requests. urllib supports the file:// scheme, which may allow an adversary who can control
the URL value to read arbitrary files on the file system.

To remediate this issue either hardcode the URLs being used in urllib or use the requests
module instead.

Example using the requests module to issue an HTTPS request:

import requests
# Issue a GET request to https://example.com with a timeout of 10 seconds
response = requests.get('https://example.com', timeout=10)
# Work with the response object
# ...

Location

File: scripts/check-eol-tables.py (line 60)

Code

    with urllib.request.urlopen(request, timeout=TIMEOUT) as response:

Remediation

No change required unless the script accepts untrusted URLs; if it does, restrict the scheme to https and block file://.


Fingerprint: 033ea68e5e04c0dbe14608c9a5460914e0f5ae32522196d47058ba1876989366
Generated by compliance-scanner
Open in Prüfwerk / In Prüfwerk öffnen

## medium Finding **Scanner:** semgrep **Severity:** medium **Rule:** gitlab-python_urlopen_rule-urllib-urlopen **CWE:** CWE-918 ### Description The application was found passing in a non-literal value to the `urllib` methods which issue requests. `urllib` supports the `file://` scheme, which may allow an adversary who can control the URL value to read arbitrary files on the file system. To remediate this issue either hardcode the URLs being used in urllib or use the `requests` module instead. Example using the `requests` module to issue an HTTPS request: ``` import requests # Issue a GET request to https://example.com with a timeout of 10 seconds response = requests.get('https://example.com', timeout=10) # Work with the response object # ... ``` ### Location **File:** `scripts/check-eol-tables.py` (line 60) ### Code ``` with urllib.request.urlopen(request, timeout=TIMEOUT) as response: ``` ### Remediation No change required unless the script accepts untrusted URLs; if it does, restrict the scheme to https and block file://. --- *Fingerprint:* `033ea68e5e04c0dbe14608c9a5460914e0f5ae32522196d47058ba1876989366` *Generated by compliance-scanner* [Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
pruefwerk added the severity:mediumcra:annex-ipruefwerk labels 2026-11-05 20:13:37 +00:00
Author
Member

Prüfwerk: In Prüfwerk als Fehlalarm (Regel) markiert.

Marked a false positive (rule) in Prüfwerk.

**Prüfwerk:** In Prüfwerk als Fehlalarm (Regel) markiert. Marked a false positive (rule) in Prüfwerk.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#913