A centralized error handler returned exception messages directly to callers. When a database failover triggered a connection error, one driver included the connection string—and its credential—in the exception text. A partner's automated client captured it in a support bundle.
What happened
A data platform introduced a centralized error handler intended to make debugging easier. When a downstream database connection failed, the handler returned the exception message and nested cause to the API caller. One database driver included connection configuration in the exception text, including a credential value.
The error occurred only during a rare failover condition. Normal requests returned clean responses, and routine integration tests did not trigger the database error path. A partner’s automated client captured the response body in its support bundle, unintentionally retaining the exposed credential.
The company rotated the credential, reviewed access logs, and introduced a safe external error envelope. Detailed diagnostics remained available only in access-controlled observability systems, with token and secret redaction applied before ingestion. Tests now inject synthetic secrets into representative exceptions and verify that none appear in responses, headers, logs, or traces.
Root cause
Exception details were returned to external callers without secret-aware redaction. Tests focused on successful requests and generic error status codes, not sensitive content in error channels.
The fix
The company replaced the error handler with a safe external error envelope that returns a correlation ID and a generic message. Detailed diagnostic information is logged internally with secrets redacted.
Testing gaps and preventive tests
Synthetic-secret canaries, exception-path coverage, response and log and trace inspection, and credential-rotation exercises. Every exception path that could surface to external callers must be tested for unintended secret exposure.
Business impact
A production credential was exposed through an error response, forcing emergency rotation and a security investigation.
Lesson learned
Error handling is part of the security boundary. Debug detail must not become public API output.