Skip to content

fix(logging): redact sensitive credentials from log output#522

Merged
emlautarom1 merged 2 commits into
NethermindEth:mainfrom
Patrick-Ehimen:fix/redact-sensitive-logs
Jul 7, 2026
Merged

fix(logging): redact sensitive credentials from log output#522
emlautarom1 merged 2 commits into
NethermindEth:mainfrom
Patrick-Ehimen:fix/redact-sensitive-logs

Conversation

@Patrick-Ehimen

Copy link
Copy Markdown
Contributor

Closes #504

Summary

  • keymanager::Client (eth2util): stores bearer token as Secret<String> (secrecy crate). Derived Debug now prints Secret([REDACTED]) instead of the raw value. expose_secret() is called only at the HTTP header construction site.
  • KeymanagerConfig (dkg): replaces derived Debug with a manual impl that prints <redacted> for auth_token, following the existing LokiConfig pattern in the tracing crate. The field stays String so the bon builder API and CLI arg tests are unchanged.
  • bootnode::resolve_relay (p2p): adds a redact_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 -- keymanagerclient_debug_redacts_auth_token passes
  • cargo test -p pluto-dkg -- keymanagerkeymanager_config_debug_redacts_auth_token passes
  • cargo test -p pluto-p2p -- bootnode::tests — all 3 redact_url_* tests pass

@emlautarom1 emlautarom1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but we could use less code given the expected usages.

Comment thread Cargo.toml Outdated
Comment thread crates/p2p/src/bootnode.rs Outdated
@emlautarom1

Copy link
Copy Markdown
Collaborator

Thanks for your contribution! Please take a look at the provided comments so we can proceed with the PR.

@Patrick-Ehimen

Copy link
Copy Markdown
Contributor Author

@emlautarom1 i will get right on it

Patrick-Ehimen added a commit to Patrick-Ehimen/pluto that referenced this pull request Jul 7, 2026
@Patrick-Ehimen Patrick-Ehimen force-pushed the fix/redact-sensitive-logs branch from 9fc130b to f7b70bb Compare July 7, 2026 10:20
- 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
@Patrick-Ehimen Patrick-Ehimen force-pushed the fix/redact-sensitive-logs branch from f7b70bb to cc3a166 Compare July 7, 2026 10:27

@emlautarom1 emlautarom1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution.

@emlautarom1 emlautarom1 merged commit c8bbe2b into NethermindEth:main Jul 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a redact logging

2 participants