feat: add slf4j structured logging with secret redaction#73
Merged
Conversation
…logging tests Fix 1 (critical): the deprecated HttpLoggingInterceptor logged request.url() and response.request().url() verbatim. The auth interceptor appends api_key downstream, so the response-summary line printed the live key at any level >= BASIC. Add LogRedaction.redactUrl and route both URL log sites through it. Fix 2: the queryRedaction test passed a null query, so redactQuery short-circuited on querySize()==0 and never ran. Drive a request whose built URL carries token=SECRET and assert url.query shows token=<redacted>. Fix 3: setBaseUrl was public only for tests. Make it package-private and relocate LoggingTest into io.getstream.services.framework so it is off the public API. Fix 4: assert all 9 client.initialized schema fields, not just 2.
…rties+options constructor
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 SLF4J structured logging via
StreamClientOptions.setLogger(...):client.initialized,http.request.sent,http.response.received,http.request.failed. Mandatory redaction of secret query params and known-secret body keys. Opt-insetLogBodieswith a one-shot WARN. Addsorg.slf4j:slf4j-api. The deprecatedHttpLoggingInterceptornow redacts secret headers and URL query values.Scope note (framework only)
The generated
services/*Impl.javastill use the retained 8-argStreamRequestconstructor (no-op logger), so events fire only once a follow-up spec-sync regeneration switches them to the new client-passing constructor. This PR is non-breaking: the old constructor is retained.Tests
LoggingTestgreen;spotlessCheckclean.