fix(security): redact credentials from debug log output#61
Open
martinraumann wants to merge 2 commits intoNVIDIA:mainfrom
Open
fix(security): redact credentials from debug log output#61martinraumann wants to merge 2 commits intoNVIDIA:mainfrom
martinraumann wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
54424c9 to
108b321
Compare
When RUST_LOG=libredfish=debug is enabled, _req() logged full request
and response bodies without redacting credential fields. Passwords
passed to create_user, change_password, change_bios_password, and
vendor-specific UEFI operations were emitted in plaintext to any log
aggregation pipeline.
Add redact_sensitive_fields() which runs a once-compiled static regex
against the serialised body before it is passed to debug!(). Fields
redacted:
Password, OldPassword, NewPassword — standard Redfish account/BIOS
CurrentUefiPassword, UefiPassword — NVIDIA DPU Bios/Settings PATCH
ImportBuffer — Dell ImportSystemConfiguration
(XML blob with OldSetupPassword)
The function returns Cow::Borrowed when no sensitive key is present,
so the common case (non-credential requests) has zero allocation cost.
Also fix the response log sites to redact before truncating, not after.
Truncating first could cut a value string before its closing quote,
breaking the regex match and leaking a partial secret.
The actual bytes sent to the BMC are never modified.
nvbug 6025253
Signed-off-by: Martin Raumann <mraumann@nvidia.com>
108b321 to
771127b
Compare
poroh
reviewed
Apr 14, 2026
Implements the reviewer suggestion (PR NVIDIA#61): instead of calling redact_sensitive_fields() eagerly at the TX debug! site, wrap the body in a RedactPasswords<'a> newtype whose Display impl calls the function. tracing evaluates format arguments lazily, so the regex now runs only when debug logging is actually enabled. RX sites retain explicit truncate(redact(...)) calls — the wrapper cannot express that ordering, and getting it wrong would leak partial secrets at truncation boundaries. nvbug 6025253 Signed-off-by: Martin Raumann <mraumann@nvidia.com>
krish-nvidia
approved these changes
Apr 14, 2026
poroh
approved these changes
Apr 14, 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.
nvbug 6025253
Summary
Fields redacted
Design notes
Test plan