Skip to content

Keep provider API keys out of the logs - #113

Merged
leonardoaraujosantos merged 1 commit into
mainfrom
fix/no-secret-urls-in-logs
Sep 29, 2026
Merged

leonardoaraujosantos merged 1 commit into
mainfrom
fix/no-secret-urls-in-logs

Conversation

@leonardoaraujosantos

Copy link
Copy Markdown
Contributor

Production logs contained the Infura API key on every chain read, for example HTTP Request: POST https://arbitrum-mainnet.infura.io/v3/<key> "HTTP/1.1 429 …". httpx logs each request URL at INFO, and Infura carries the key in the URL path.

Fix

chatmemory.logging.configure sets the HTTP client loggers (httpx, httpx2, httpcore, httpcore2) to WARNING. Their errors are still logged; the per-request lines aren't. Every entrypoint goes through this setup.

Tests

tests/unit/test_logging_secrets.py covers two things:

  • the HTTP loggers aren't enabled at INFO after configure;
  • an Infura request line logged through httpx never reaches the captured log.

Follow-up

The key already in the logs should be rotated; the production key was switched separately.

httpx logs every request URL at INFO, and Infura puts the API key in
the URL path, so production logs carried the key on every chain read.
The HTTP client loggers now start at WARNING, keeping their errors.
@leonardoaraujosantos
leonardoaraujosantos merged commit 48e2529 into main Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant