Skip to content

Fix sensitive data exposure in Baremetal PING PXE resource logs (#13298)#13668

Open
DaanHoogland wants to merge 1 commit into
4.20from
ghi13298-logging
Open

Fix sensitive data exposure in Baremetal PING PXE resource logs (#13298)#13668
DaanHoogland wants to merge 1 commit into
4.20from
ghi13298-logging

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

SSHCmdHelper.sshExecuteCmdOneShot only redacted logged commands by splitting on the literal keystore filename "cloud.jks", which never appears in baremetal PXE commands. As a result, CIFS storage passwords and raw VM user-data/SSH keys built by BaremetalPingPxeResource were logged in plaintext at debug level.

Add maskedCmd-accepting overloads to SSHCmdHelper so callers can supply an already-redacted command for logging, and use them in BaremetalPingPxeResource for the CIFS password and VM user-data code paths, including the failure messages returned in the Answer objects.

This PR...

Fixes: #13298

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

SSHCmdHelper.sshExecuteCmdOneShot only redacted logged commands by
splitting on the literal keystore filename "cloud.jks", which never
appears in baremetal PXE commands. As a result, CIFS storage passwords
and raw VM user-data/SSH keys built by BaremetalPingPxeResource were
logged in plaintext at debug level.

Add maskedCmd-accepting overloads to SSHCmdHelper so callers can supply
an already-redacted command for logging, and use them in
BaremetalPingPxeResource for the CIFS password and VM user-data code
paths, including the failure messages returned in the Answer objects.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
19.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 10.41667% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.26%. Comparing base (e8df87e) to head (0107dc5).

Files with missing lines Patch % Lines
...metal/networkservice/BaremetalPingPxeResource.java 0.00% 23 Missing ⚠️
...rc/main/java/com/cloud/utils/ssh/SSHCmdHelper.java 20.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #13668   +/-   ##
=========================================
  Coverage     16.26%   16.26%           
- Complexity    13435    13437    +2     
=========================================
  Files          5667     5667           
  Lines        500731   500769   +38     
  Branches      60803    60803           
=========================================
+ Hits          81430    81448   +18     
- Misses       410197   410215   +18     
- Partials       9104     9106    +2     
Flag Coverage Δ
uitests 4.14% <ø> (ø)
unittests 17.12% <10.41%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Sensitive User Data and Storage Credentials Exposure in Baremetal PING PXE Resource Logs

1 participant