Skip to content

chore: add psr-3 structured logging with secret redaction#55

Merged
mogita merged 4 commits into
masterfrom
feat/cha-2957-logging
Jul 22, 2026
Merged

chore: add psr-3 structured logging with secret redaction#55
mogita merged 4 commits into
masterfrom
feat/cha-2957-logging

Conversation

@mogita

@mogita mogita commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

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-in logBodies with 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.failed message is scrubbed of URL-embedded secrets (Guzzle connect errors embed the full request URL, which carries api_key).

Tests

make test-unit green (293); tests/Http/LoggingTest.php covers events, redaction, and the message scrub.

mogita added 3 commits July 22, 2026 15:53
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.
@mogita mogita changed the title feat: add psr-3 structured logging with secret redaction chore: add psr-3 structured logging with secret redaction Jul 22, 2026
@mogita

mogita commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Titled chore: (not feat:) intentionally: this repo's Release workflow derives the version bump from the PR-title type and skips releasing when the type is not feat/fix, so merging this will not auto-publish. The change is a feature; when you want to publish, run the Release workflow manually (workflow_dispatch, version bump = minor).

@mogita
mogita merged commit bbdda75 into master Jul 22, 2026
7 checks passed
@mogita
mogita deleted the feat/cha-2957-logging branch July 22, 2026 17:18
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