fix: redact and zero out plaintext SASL credentials after handshake#350
Open
suchitd wants to merge 1 commit into
Open
fix: redact and zero out plaintext SASL credentials after handshake#350suchitd wants to merge 1 commit into
suchitd wants to merge 1 commit into
Conversation
- Implement `fmt.Stringer` on `PlainAuth` and `AMQPlainAuth` to redact passwords from logs, reflection, or APM dumps. - Zero out credentials in `Connection.Config.SASL` after a successful handshake in `openComplete()`. - Extract SASL setup from connection URIs into a new helper method `Config.setSASL(uri URI)`. - Reset and reinitialize SASL credentials from the connection recovery URL (`c.url`) in `Reconnect()` to ensure automatic reconnection succeeds after the previous connection's credentials were zeroed out. - Add comprehensive unit tests in `auth_test.go` and `connection_unit_test.go` verifying redacting, zeroing, and recovery restoration of credentials.
63e05ab to
0253bfc
Compare
MirahImage
approved these changes
Jun 17, 2026
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.
Proposed Changes
fmt.StringeronPlainAuthandAMQPlainAuthto redact passwords from logs, reflection, or APM dumps.Connection.Config.SASLafter a successful handshake inopenComplete().Config.setSASL(uri URI).c.url) inReconnect()to ensure automatic reconnection succeeds after the previous connection's credentials were zeroed out.auth_test.goandconnection_unit_test.goverifying redacting, zeroing, and recovery restoration of credentials.Types of Changes
Checklist
CONTRIBUTING.mddocument