fix(middleware): don't log admin password on basic-auth failure#279
Merged
Conversation
The admin basic-auth rejection log line included the attempted password verbatim, e.g. "[WARN] admin basic auth failed, user/passwd mismatch, admin:hunter2". A mistyped legitimate password (often differs from the real one by one character) or a misrouted password manager submission ends up in plaintext logs that may be shipped to centralised logging, crash bundles or third-party observability systems. Drop the password from the log line; keep only the username so an operator can still tell who failed. Affects v1 (middleware/auth.go:238) and v2 (v2/middleware/auth.go:246). Reported during a security audit alongside the v1 from-redirect issue and the Apple iss/aud gap (those tracked separately).
Coverage Report for CI Build 25569788009Coverage increased (+0.4%) to 84.66%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Merged
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
Admin basic-auth rejection log line currently includes the attempted password verbatim:
A mistyped legitimate password (often one character off the real one) or a misrouted password-manager submission lands in plaintext logs that may be shipped to centralised logging, crash bundles, or third-party observability systems.
Change
Drop the password from the log line, keep the username:
Same fix in v1 (
middleware/auth.go:238) and v2 (v2/middleware/auth.go:246), single PR.Test
New
TestBasicAdminUserDoesNotLogPasswordin both modules — captures the logger output, callsbasicAdminUserwith a wrong password, asserts the password substring is not in the captured output and the rejection is still logged.Confirmed RED→GREEN locally:
admin:super-secret-attempted-passwd