Skip to content

Sanitize the rbd file cmd parameter logs during qemu-img convert (through Script) - #11801

Merged
DaanHoogland merged 1 commit into
apache:4.20from
shapeblue:sanitize-rbd-convert-cmd
Oct 8, 2025
Merged

Sanitize the rbd file cmd parameter logs during qemu-img convert (through Script)#11801
DaanHoogland merged 1 commit into
apache:4.20from
shapeblue:sanitize-rbd-convert-cmd

Conversation

@sureshanaparti

@sureshanapartisureshanaparti commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

Description

This PR sanitises the rbd file cmd parameter logs during qemu-img convert (through Script).

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?

Verified logs using deploy instance and migrate volume on ceph/rbd storage.

2025-10-08 08:53:16,375 DEBUG [utils.script.Script] (AgentRequest-Handler-3:[]) (logid:) Executing command [qemu-img convert -O raw -U --image-opts driver=qcow2,file.filename=/mnt/36a52cb4-35af-3fa2-8c7f-5bde0254737e/0c364cce-8288-3a92-9234-4ffde372aec7.qcow2 rbd:cloudstack/a31a9020-a406-11f0-b615-1e00b300036f:mon_host=10.0.33.201:auth_supported=cephx:id=cloudstack:key=******:rbd_default_format=2:client_mount_timeout=30 ].
2025-10-08 08:55:12,502 DEBUG [utils.script.Script] (AgentRequest-Handler-3:[]) (logid:) Successfully executed process [30511] for command [qemu-img convert -O raw -U --image-opts driver=qcow2,file.filename=/mnt/36a52cb4-35af-3fa2-8c7f-5bde0254737e/0c364cce-8288-3a92-9234-4ffde372aec7.qcow2 rbd:cloudstack/a31a9020-a406-11f0-b615-1e00b300036f:mon_host=10.0.33.201:auth_supported=cephx:id=cloudstack:key=******:rbd_default_format=2:client_mount_timeout=30 ].
2025-10-08 08:59:52,365 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:) Executing command [qemu-img convert -O qcow2 -U rbd:cloudstack/83e1deb7-afff-4d51-b0cd-5e2390427a30:mon_host=10.0.33.201:auth_supported=cephx:id=cloudstack:key=******:rbd_default_format=2:client_mount_timeout=30 /mnt/529b3b91-2f25-301c-8a4b-4867d3cd2224/654ce284-f1ad-4635-a7ac-a5cc1b43fc1d.qcow2 ].
2025-10-08 09:00:14,170 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:) Successfully executed process [33557] for command [qemu-img convert -O qcow2 -U rbd:cloudstack/83e1deb7-afff-4d51-b0cd-5e2390427a30:mon_host=10.0.33.201:auth_supported=cephx:id=cloudstack:key=******:rbd_default_format=2:client_mount_timeout=30 /mnt/529b3b91-2f25-301c-8a4b-4867d3cd2224/654ce284-f1ad-4635-a7ac-a5cc1b43fc1d.qcow2 ].

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

@sureshanaparti

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves command parameter sanitization by refactoring existing VI URL sanitization and adding new RBD file format parameter sanitization. The changes protect sensitive information like authentication keys from being exposed in command line logs.

  • Refactored existing VI URL parameter sanitization into a dedicated method
  • Added sanitization for RBD file format parameters containing authentication keys
  • Consolidated sanitization logic to improve code maintainability

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment threadutils/src/main/java/com/cloud/utils/script/Script.java Outdated
Comment threadutils/src/main/java/com/cloud/utils/script/Script.java Outdated
@sureshanapartisureshanaparti changed the title Sanitize the rbd file cmd parameter during the convert through ScriptSanitize the rbd file cmd parameter logs during qemu-img convert (through Script)Oct 7, 2025
@codecov

codecovBot commented Oct 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 24.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.17%. Comparing base (823cb00) to head (7fdfc11).
⚠️ Report is 6 commits behind head on 4.20.

Files with missing linesPatch %Lines
...s/src/main/java/com/cloud/utils/script/Script.java24.00%16 Missing and 3 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## 4.20 #11801 +/- ##
=========================================
Coverage 16.17% 16.17% - Complexity 13295 13298 +3 
=========================================
Files 5656 5656 Lines 498262 498282 +20 Branches 60464 60466 +2 =========================================
+ Hits 80582 80587 +5 - Misses 408710 408723 +13 - Partials 8970 8972 +2 
FlagCoverage Δ
uitests4.00% <ø> (ø)
unittests17.02% <24.00%> (+<0.01%)⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@sureshanaparti
sureshanapartiforce-pushed the sanitize-rbd-convert-cmd branch from a784e50 to 7fdfc11CompareOctober 7, 2025 10:53
@sureshanaparti

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15317

@sureshanaparti
sureshanaparti marked this pull request as ready for review October 8, 2025 09:03

@rajujithrajujith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested
key is masked in the logs.

@sureshanaparti

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@weizhouapacheweizhouapache added this to the 4.20.2 milestone Oct 8, 2025

@weizhouapacheweizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@DaanHoogland
DaanHoogland merged commit b143ddc into apache:4.20Oct 8, 2025
25 of 26 checks passed
@DaanHoogland
DaanHoogland deleted the sanitize-rbd-convert-cmd branch October 8, 2025 11:55
@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14574)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 58571 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11801-t14574-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 17, 2025
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Oct 21, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@sureshanaparti@blueorangutan@rajujith@weizhouapache@DaanHoogland