chore: add psr-3 structured logging with secret redaction#55
Merged
Conversation
Guzzle's ConnectException/GuzzleException messages embed the full request URL, including api_key/api_secret/token query params. That message was logged verbatim into error.message on http.request.failed, leaking live secrets on every DNS/connect/TLS/timeout failure even though the sibling url.query field was already redacted. Add LogRedaction::redactMessage() to scrub key=value occurrences of the known secret keys anywhere in a free-form string, and apply it at the http.request.failed emission site.
…nder paratest workers
Collaborator
Author
|
Titled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://linear.app/stream/issue/CHA-2957/logging
Summary
Adds PSR-3 structured logging via
ClientBuilder::logger(...):client.initialized,http.request.sent,http.response.received,http.request.failed. Mandatory redaction of secret query params and known-secret body keys. Opt-inlogBodieswith a one-shot WARN.Behavior change
The prior
error_log()pool-config line is removed; construction info now goes only to the injected PSR-3 logger. No logger = no output.Security
The
http.request.failedmessage is scrubbed of URL-embedded secrets (Guzzle connect errors embed the full request URL, which carriesapi_key).Tests
make test-unitgreen (293);tests/Http/LoggingTest.phpcovers events, redaction, and the message scrub.