fix(apple): redact tokens from exchange-response debug log#284
Merged
Conversation
The handler logged the full appleVerificationResponse struct on a
DEBUG line:
[DEBUG] response data {AccessToken:M... TokenType:bearer ...
RefreshToken:Iw... IDToken:eyJ...}
AccessToken, RefreshToken and IDToken are bearer credentials. With
DEBUG-level logging enabled (default in many staging setups) these
ended up in stdout, file logs, centralised logging, crash bundles
and third-party observability — anywhere log access doesn't imply
auth-server-process compromise.
Replace the raw %+v dump with appleVerificationResponseLogSummary,
which logs only the non-secret fields plus presence indicators
(present|missing) for each token. Operators can still tell whether
a response carried each token; the value never leaks.
Same redaction in v1 (provider/apple.go:334) and v2
(v2/provider/apple.go:334), single PR.
Tests: TestAppleVerificationResponseLogSummary asserts the helper
omits the three secret values verbatim and reports presence/missing
correctly. Added in both modules.
Coverage Report for CI Build 25572510465Coverage increased (+0.5%) to 84.706%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Summary
The Apple handler logged the full
appleVerificationResponsestruct on a[DEBUG]line:AccessToken,RefreshTokenandIDTokenare bearer credentials. With DEBUG-level logging enabled (default in many staging setups) these landed in stdout, file logs, centralized logging, crash bundles, and any third-party observability stack — anywhere log access doesn't imply auth-server-process compromise.Change
Replace the raw
%+vdump withappleVerificationResponseLogSummary, which logs only the non-secret fields plus presence indicators (present|missing) for each token. Operators can still tell whether a response carried each token; the value never leaks.Same redaction in v1 (
provider/apple.go:334) and v2 (v2/provider/apple.go:334), single PR.Test
TestAppleVerificationResponseLogSummaryasserts the helper omits the three secret values verbatim and reports presence/missing correctly. Added in both modules. Fullgo test -race ./...green;golangci-lint run --new-from-rev=master0 issues.