fix(logging): redact sensitive credentials from log output#522
Open
Patrick-Ehimen wants to merge 1 commit into
Open
fix(logging): redact sensitive credentials from log output#522Patrick-Ehimen wants to merge 1 commit into
Patrick-Ehimen wants to merge 1 commit into
Conversation
- Use Secret<String> in keymanager::Client so Debug prints [REDACTED] - Manual Debug for KeymanagerConfig that redacts auth_token - redact_url() helper in bootnode strips userinfo before log fields - Unit tests for each redaction site
emlautarom1
requested changes
Jul 6, 2026
emlautarom1
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, but we could use less code given the expected usages.
| subtle = "2.6" | ||
| unicode-normalization = "0.1.25" | ||
| zeroize = "1.8.2" | ||
| secrecy = "0.8" |
Collaborator
There was a problem hiding this comment.
Please bump to the latest version
Suggested change
| secrecy = "0.8" | |
| secrecy = "0.10" |
Comment on lines
+153
to
+164
| fn redact_url(raw: &str) -> String { | ||
| let Ok(mut url) = Url::parse(raw) else { | ||
| return raw.to_owned(); | ||
| }; | ||
| if url.username().is_empty() && url.password().is_none() { | ||
| return raw.to_owned(); | ||
| } | ||
| if url.set_username("").is_err() || url.set_password(None).is_err() { | ||
| return "<redacted>".to_owned(); | ||
| } | ||
| url.to_string() | ||
| } |
Collaborator
There was a problem hiding this comment.
Relays do not carry credentials and we do not intend to support such feature. For reference check Charon v1.7.1: https://github.com/ObolNetwork/charon/blob/749d2d7ab0b8ace34f2e686a5af5910c8adb4dc0/p2p/bootnode.go#L155.
Collaborator
|
Thanks for your contribution! Please take a look at the provided comments so we can proceed with the PR. |
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.
Closes #504
Summary
keymanager::Client(eth2util): stores bearer token asSecret<String>(secrecy crate). DerivedDebugnow printsSecret([REDACTED])instead of the raw value.expose_secret()is called only at the HTTP header construction site.KeymanagerConfig(dkg): replaces derivedDebugwith a manual impl that prints<redacted>forauth_token, following the existingLokiConfigpattern in the tracing crate. The field staysStringso thebonbuilder API and CLI arg tests are unchanged.bootnode::resolve_relay(p2p): adds aredact_url()helper that strips embedded userinfo (basic-auth credentials) from relay URLs before they appear in tracing fields.Test plan
cargo test -p pluto-eth2util -- keymanager—client_debug_redacts_auth_tokenpassescargo test -p pluto-dkg -- keymanager—keymanager_config_debug_redacts_auth_tokenpassescargo test -p pluto-p2p -- bootnode::tests— all 3redact_url_*tests pass