Skip to content

Commit 15eccb4

Browse files
Potential fix for code scanning alert no. 59: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent c7cf7aa commit 15eccb4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

common/http_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ async def async_request(
151151
except httpx.RequestError as exc:
152152
last_exc = exc
153153
if attempt >= retries:
154-
if not _is_sensitive_url(url):
155-
log_url = _redact_sensitive_url_params(url)
156-
logger.warning(f"async_request exhausted retries for {method} {log_url}")
157-
raise
158-
delay = _get_delay(backoff_factor, attempt)
159-
if not _is_sensitive_url(url):
160-
log_url = _redact_sensitive_url_params(url)
154+
# Do not log the full URL here to avoid leaking sensitive data.
161155
logger.warning(
162-
f"async_request attempt {attempt + 1}/{retries + 1} failed for {method} {log_url}; retrying in {delay:.2f}s"
156+
f"async_request exhausted retries for {method}; last error: {exc}"
163157
)
158+
raise
159+
delay = _get_delay(backoff_factor, attempt)
160+
# Avoid including the (potentially sensitive) URL in retry logs.
161+
logger.warning(
162+
f"async_request attempt {attempt + 1}/{retries + 1} failed for {method}; retrying in {delay:.2f}s"
163+
)
164164
await asyncio.sleep(delay)
165165
raise last_exc # pragma: no cover
166166

0 commit comments

Comments
 (0)