| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report❌ Patch coverage is 35.71429% with 9 lines in your changes missing coverage. Please review. @@ Coverage Diff @@
## 4.20 #12404 +/- ##
============================================
+ Coverage 4.00% 16.23% +12.22%
- Complexity 0 13379 +13379
============================================
Files 402 5657 +5255
Lines 32688 499039 +466351
Branches 5822 60567 +54745
============================================
+ Hits 1309 81014 +79705
- Misses 31224 408990 +377766
- Partials 155 9035 +8880
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
There was a problem hiding this comment.
code lgtm
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@abh1sar 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. |
Sorry, something went wrong.
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("VM [%s] with XML configuration [%s] will be migrated to host [%s].", vmName, xmlDesc, target)); | ||
| logger.debug("VM {} with XML configuration {} will be migrated to host {}.", vmName, maskSensitiveInfoInXML(xmlDesc), target); | ||
| } |
There was a problem hiding this comment.
| if (logger.isDebugEnabled()) { | |
| logger.debug(String.format("VM [%s] with XML configuration [%s] will be migrated to host [%s].", vmName, xmlDesc, target)); | |
| logger.debug("VM {} with XML configuration {} will be migrated to host {}.", vmName, maskSensitiveInfoInXML(xmlDesc), target); | |
| } | |
| logger.debug("VM {} with XML configuration {} will be migrated to host {}.", vmName, () -> maskSensitiveInfoInXML(xmlDesc), target); |
just a suggestion, (may apply below as well)
Sorry, something went wrong.
There was a problem hiding this comment.
clgtm, the isDebugEnabled are not strictly needed anymore.
Sorry, something went wrong.
| public static String maskSensitiveInfoInXML(String xmlDesc) { | ||
| if (xmlDesc == null) return null; | ||
| // Mask VNC password in XML for logging | ||
| return xmlDesc.replaceAll("(graphics\\s+[^>]*type=['\"]vnc['\"][^>]*passwd=['\"])([^'\"]*)(['\"])", |
There was a problem hiding this comment.
we can also just remove it, btw
Sorry, something went wrong.
There was a problem hiding this comment.
Wont it confuse admin whether vnc section is not part of the xml or not?
Sorry, something went wrong.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16334 |
Sorry, something went wrong.
|
@abh1sar a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Sorry, something went wrong.
|
Thanks @DaanHoogland for your review and suggestions. Let me know if my response makes sense:
logger.debug("VM {} with XML configuration {} will be migrated to host {}.", vmName, () -> maskSensitiveInfoInXML(xmlDesc), target);
|
Sorry, something went wrong.
this is not how I read the documentation, but I haven’t tested it. it should lazily evaluate the lambda ony if debug is enabled.
I do not care if point 1 is out of the way. It is just cleaner code. If you are right about point 1 we have a bigger issue. I do not think either should stop this PR, but in general my experience is that follow-ups don’t happen,... |
Sorry, something went wrong.
|
[SF] Trillian test result (tid-15170)
|
Sorry, something went wrong.
There was a problem hiding this comment.
The PR successfully masks VNC passwords in most scenarios, but there is one missed log statement in the LibvirtMigrateCommandWrapper that still exposes the actual VNC password during all types of live migration.
Bug Summary
Impact: VNC password exposed in DEBUG level logs during any live migration operation
Confirmed in TC2, TC7, and TC8 across both migration directions and storage migration
| Test Case | Description | Result |
|---|---|---|
| TC1 | VM Start - VNC Password Masking | PASSED |
| TC2 | Live Migration - VNC Password Masking | PARTIAL |
| TC3 | Console Access Regression | PASSED |
| TC4 | VM Stop/Start - VNC Password Masking | PASSED |
| TC5 | VM Reboot - VNC Password Masking | PASSED |
| TC6 | System VM - VNC Password Masking | PASSED |
| TC7 | Reverse Migration - VNC Password Masking | PARTIAL |
| TC8 | Storage Migration - VNC Password Masking | PARTIAL |
Objective Verify that the VNC password is masked (shown as *****) in the agent log when a VM is started.
Test Steps
grep -i "Starting.*:" /var/log/cloudstack/agent/agent.log | tail -5
grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log
grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Expected Result
Actual Result PASSED
Evidence
2026-01-18 16:57:28,843 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (AgentRequest-Handler-5:[]) (logid:) Starting r-4-VM : <domain type='kvm'>
VNC password masked (grep output):
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log <graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Objective Verify that the VNC password is masked (shown as *****) in the agent log when a VM is live migrated between KVM hosts.
Test Steps
grep -i "live migration" /var/log/cloudstack/agent/agent.log
grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log
grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Expected Result
Actual Result PARTIALLY PASSED / BUG FOUND
Evidence
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -i "live migration" /var/log/cloudstack/agent/agent.log 2026-01-18 17:05:14,161 INFO [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Starting live migration of instance i-2-3-VM to destination host qemu+tls://10.1.33.95/system having the final XML configuration: <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log
<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='*****'>
2026-01-18 17:05:14,129 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:)
[<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='*****'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log 2026-01-18 17:05:14,129 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:)
[<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
Bug Details
The replaceIpForVNCInDescFile method in LibvirtMigrateCommandWrapper.java logs the old and new XML snippets when replacing the VNC IP address, but this log statement is not using the maskSensitiveInfoInXML() function, causing the actual VNC password (UzAp0PQ9) to be exposed in the agent log.
Affected log message: "Replaced the VNC IP address [...] with [...]"
Objective Verify that the VNC password masking in logs does not break the actual VM console access functionality.
Test Steps
Expected Result
**Actual Result: ** PASSED
Evidence
Objective Verify that the VNC password remains masked in the agent log when a VM is stopped and then started again.
Test Steps
grep -i "Starting.*:" /var/log/cloudstack/agent/agent.log | tail -5 grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Expected Result
Actual Result: PASSED
Evidence:
2026-01-18 17:17:44,269 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (AgentRequest-Handler-4:[]) (logid:) Starting i-2-3-VM : <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log <graphics type='vnc' autoport='yes' listen='10.1.33.95' passwd='*****'/>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Objective Verify that the VNC password remains masked in the agent log when a VM is rebooted.
Test Steps:
Expected Result
**Actual Result: ** PASSED
Evidence:
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -i "Starting.*i-2-3-VM" /var/log/cloudstack/agent/agent.log | tail -3 2026-01-18 17:17:44,269 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (AgentRequest-Handler-4:[]) (logid:) Starting i-2-3-VM : <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log <graphics type='vnc' autoport='yes' listen='10.1.33.95' passwd='*****'/>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
Notes VM reboot operation is handled by libvirt's internal restart mechanism and does not trigger a new CloudStack StartCommand. This is expected behavior - the PR's masking is only relevant when CloudStack explicitly logs VM XML configurations during start or migration operations.
Objective Verify that the VNC password is also masked for System VMs (SSVM, CPVM, Virtual Router).
Test Steps
Expected Result:
Actual Result: PASSED
Evidence:
/var/log/cloudstack/agent/agent.log.2026-01-14.gz:2026-01-14 14:12:47,490 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Starting s-1-VM : <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# zgrep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log* | head -20 /var/log/cloudstack/agent/agent.log:<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/> /var/log/cloudstack/agent/agent.log:<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/> /var/log/cloudstack/agent/agent.log: <graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='*****'> /var/log/cloudstack/agent/agent.log:2026-01-18 17:05:14,129 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'> /var/log/cloudstack/agent/agent.log: </graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'> /var/log/cloudstack/agent/agent.log: <graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='*****'> /var/log/cloudstack/agent/agent.log.2026-01-14.gz:<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
(Note: Unmasked password visible is the known TC2 bug from migration)
/var/log/cloudstack/agent/agent.log.2026-01-14.gz:2026-01-14 14:13:12,611 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (AgentRequest-Handler-5:[]) (logid:) Starting v-2-VM : <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# zgrep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log* | head -20 /var/log/cloudstack/agent/agent.log:<graphics type='vnc' autoport='yes' listen='10.1.33.95' passwd='*****'/> /var/log/cloudstack/agent/agent.log.2026-01-14.gz:<graphics type='vnc' autoport='yes' listen='10.1.33.95' passwd='*****'/>
Objective: Confirm that the bug found in TC2 (unmasked VNC password in "Replaced the VNC IP address" log message) is reproducible when migrating in the reverse direction.
TestSteps:
Expected Result: All VNC passwords should be masked as passwd='*****'
Actual Result: PARTIAL - Bug Confirmed
Evidence:
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -i "live migration" /var/log/cloudstack/agent/agent.log | tail -3 2026-01-18 17:53:20,092 INFO [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Starting live migration of instance i-2-3-VM to destination host qemu+tls://10.1.34.189/system having the final XML configuration: <domain type='kvm'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log
<graphics type='vnc' autoport='yes' listen='10.1.33.95' passwd='*****'/>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='*****'>
2026-01-18 17:53:20,066 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='*****'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm2 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
2026-01-18 17:53:20,066 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
Notes: This confirms the bug identified in TC2 is consistent and reproducible in both migration directions (kvm1→kvm2 and kvm2→kvm1). The same VNC password is exposed in both cases.
Objective: Verify that the VNC password is masked when performing live migration with storage (migrating VM and its volumes to a different storage pool simultaneously).
Test Steps:
migrate virtualmachinewithvolume virtualmachineid=1170e952-de03-410e-8d8a-896260abf583 hostid=550f5e3f-78e6-4229-b9f4-bc0f07eca952 migrateto[0].volume=a3984f50-61fa-4d41-91a7-3d34058c3c16 migrateto[0].pool=f9d5d615-0697-31e6-9e66-978f2974640f
Expected Result:
Actual Result PARTIAL - Same bug as TC2/TC7
Evidence:
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd" /var/log/cloudstack/agent/agent.log | tail -10
<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
<graphics type='vnc' autoport='yes' listen='10.1.34.189' passwd='*****'/>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='*****'>
2026-01-18 17:05:14,129 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:)
Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='*****'>
<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='*****'>
2026-01-18 17:59:41,528 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-1:[]) (logid:)
Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
[root@ref-trl-6151-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
2026-01-18 17:05:14,129 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:)
Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
2026-01-18 17:59:41,528 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-1:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.34.189' passwd='UzAp0PQ9'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.1.33.95' passwd='UzAp0PQ9'>
Notes Storage migration (17:59:41) uses the same LibvirtMigrateCommandWrapper code path as regular live migration
The same bug occurs regardless of whether storage is being migrated along with the VM
Volume successfully moved from pri1 (404b015d-...) to pri2 (f9d5d615-...)
Sorry, something went wrong.
|
Thank you @RosiKyu for the extremely detailed QA validation. This is very helpful. I have addressed the issue by masking the XML in the log statement within replaceIpForVNCInDescFileAndNormalizePassword method. Please re-test TC2, TC7, and TC8 with the updated package. |
Sorry, something went wrong.
|
@sudo87 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. |
Sorry, something went wrong.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16411 |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
The identified issue was addressed and password is masked in all logs.
Expected Result: All VNC passwords should be masked as passwd='*****'
Actual Result PASSED (verified after fix)
Reverse migration also shows properly masked passwords
Evidence (after fix):
Agent update timeline on kvm1:
Agent stopped: 2026-01-19 08:50:46
Agent started: 2026-01-19 08:53:09 (with cloudstack-agent-4.20.3.0-shapeblue18646)
Before agent update (04:59:59) - password EXPOSED:
[root@ref-trl-10611-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -i "Replaced the VNC IP address" /var/log/cloudstack/agent/agent.log 2026-01-19 04:59:59,508 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.0.35.40' passwd='OjdZYxCj'> 2026-01-19 09:02:39,662 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Replaced the VNC IP address <graphics type='vnc' port='-1' autoport='yes' listen='10.0.35.40' passwd='*****'>
[root@ref-trl-10611-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -E "graphics.*vnc.*passwd=['\"][^*]" /var/log/cloudstack/agent/agent.log
2026-01-19 04:59:59,508 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-3:[]) (logid:) Replaced the VNC IP address [<graphics type='vnc' port='-1' autoport='yes' listen='10.0.35.40' passwd='OjdZYxCj'>
</graphics>] with [<graphics type='vnc' port='-1' autoport='yes' listen='10.0.35.42' passwd='OjdZYxCj'>
(The grep for unmasked passwords only returns the old 04:59:59 entry - the new 09:02:39 entry is properly masked and does not appear)
[root@ref-trl-10611-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep -i "Replaced the VNC IP address" /var/log/cloudstack/agent/agent.log 2026-01-19 09:02:39,662 DEBUG [resource.wrapper.LibvirtMigrateCommandWrapper] (AgentRequest-Handler-2:[]) (logid:) Replaced the VNC IP address <graphics type='vnc' port='-1' autoport='yes' listen='10.0.35.40' passwd='*****'>
| Test Case | Description | Result |
|---|---|---|
| TC1 | VM Start - VNC Password Masking | PASSED |
| TC2 | Live Migration - VNC Password Masking | PASSED |
| TC3 | Console Access Regression | PASSED |
| TC4 | VM Stop/Start - VNC Password Masking | PASSED |
| TC5 | VM Reboot - VNC Password Masking | PASSED |
| TC6 | System VM - VNC Password Masking | PASSED |
| TC7 | Reverse Migration - VNC Password Masking | PASSED |
| TC8 | Storage Migration - VNC Password Masking | PASSED |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
This PR fixes #10847
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?