Catching leaked API keys in agent tool logs before they hit your S3/ClickHouse analytics bucket
To debug multi-step agent failures, we log every tool call's request/response JSON to ClickHouse and S3.
While auditing yesterday's traces, we found a nasty surprise: a user's MCP tool hit an upstream 500, and the exception string echoed back the full postgres://user:password@host/db URL and an Authorization: Bearer ... header straight into our telemetry table.
Standard regexes catch sk-... and ghp_..., but miss custom internal tokens or high-entropy query params like ?sig=....
What are people running in Python/Go right before logger.info or S3 flush to scrub secrets reliably without tanking throughput?