How a Python exception handler silently leaked tenant secrets to production logs
A production incident exposed tenant configuration secrets in plain text logs after a sensitive config object was interpolated into an exception message string. The root cause was not the 'raise e' statement itself, but the fact that Python frameworks like dataclasses and Pydantic auto-generate detailed __repr__ outputs that include all fields, including API keys and tokens. When the config object was embedded in an f-string error message, its full repr was baked into the exception before any logging occurred. A code path change introduced by a new feature deployment connected three pre-existing conditions — a sensitive object in scope, string interpolation into exceptions, and exception-capturing logging — for the first time. The incident went undetected for two days, highlighting how such leaks can remain dormant until the right runtime conditions align.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in