Escape snapshot names in libvirt XML - #14201
sureshanaparti wants to merge 1 commit into
Conversation
|
@blueorangutan package |
|
@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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14201 +/- ##
============================================
+ Coverage 17.97% 17.98% +0.01%
- Complexity 16184 16191 +7
============================================
Files 5930 5930
Lines 535615 535615
Branches 65582 65582
============================================
+ Hits 96271 96341 +70
+ Misses 428377 428301 -76
- Partials 10967 10973 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
131ee43 to
b8e990d
Compare
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19284 |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
JoaoJandre
left a comment
There was a problem hiding this comment.
CLGTM, did not test it
|
[SF] Trillian test result (tid-17026)
|
Description
This PR escapes the snapshot names in the three places that build the document: LibvirtCreateVMSnapshotCommandWrapper, generateVMSnapshotXML (snapshot and parent), and the MessageFormat argument in LibvirtManageSnapshotCommandWrapper.
The raw name still goes to snapshotLookupByName, which takes a plain string, not markup.
Uses commons-lang StringEscapeUtils.escapeXml, same as LibvirtVMDef does for the VNC password, so no new dependency. Create and restore escape identically, so existing snapshots are still found by name.
The KVM wrappers build documents by string concatenation and drop the snapshot name straight in.
A name carrying XML metacharacters could close the element early and add arbitrary children, such as a block pointing anywhere on the hypervisor.
Nothing reaching these sinks today can carry a metacharacter: on KVM the vm.instancename.flag path is gated on VMware, hostnames go through NetUtils.verifyDomainNameLabel, and KVMStorageProcessor uses random UUIDs.
This is hardening so the sink no longer depends on its callers.
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?