Skip to content

Commit b0ece22

Browse files
CarlesUIPathclaude
andcommitted
fix(litellm): silence bandit B310 on the preflight urlopen
The litellm preflight opens LITELLM_BASE_URL/health/liveliness to fail fast when the proxy is down. bandit flags urlopen (B310, permitted-schemes) at medium — but the URL is built from the operator-configured LITELLM_BASE_URL, not untrusted input, so scope a nosec B310 with justification. Unblocks the Quality Gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8510002 commit b0ece22

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/coder_eval/cli/run_command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ def _litellm_preflight_error(current_settings: Settings) -> str | None:
8484
return None
8585
url = f"{current_settings.litellm_base_url.rstrip('/')}/health/liveliness"
8686
try:
87-
urllib.request.urlopen(url, timeout=5).close()
87+
# B310: url is built from the operator-configured LITELLM_BASE_URL (not
88+
# untrusted input); this only probes reachability of that proxy endpoint.
89+
urllib.request.urlopen(url, timeout=5).close() # nosec B310
8890
except urllib.error.HTTPError:
8991
return None # server responded (up), just not 200 on this path
9092
except (urllib.error.URLError, OSError) as exc:

0 commit comments

Comments
 (0)