Test that quotes and ampersand are XML escaped

This ensures that we are safe if we interpolate into an XML attribute.
This commit is contained in:
Demi Marie Obenour 2021-05-10 00:38:10 -04:00
parent f9bfcd8732
commit 5db7af0ce4
No known key found for this signature in database
GPG Key ID: 28A45C93B0B5B6E0

View File

@ -961,7 +961,7 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase):
<loader type="rom">hvmloader</loader> <loader type="rom">hvmloader</loader>
<boot dev="cdrom" /> <boot dev="cdrom" />
<boot dev="hd" /> <boot dev="hd" />
<cmdline>kernel &lt;text&gt; specific options</cmdline> <cmdline>kernel &lt;text&gt;&#39;&#34;&amp; specific options</cmdline>
</os> </os>
<features> <features>
<pae/> <pae/>
@ -1000,7 +1000,7 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase):
open(os.path.join(kernel_dir, 'initramfs'), 'w').close() open(os.path.join(kernel_dir, 'initramfs'), 'w').close()
with open(os.path.join(kernel_dir, with open(os.path.join(kernel_dir,
'default-kernelopts-common.txt'), 'w') as f: 'default-kernelopts-common.txt'), 'w') as f:
f.write('kernel <text> specific options \n') f.write('kernel <text>\'"& specific options \n')
self.addCleanup(shutil.rmtree, '/tmp/qubes-test') self.addCleanup(shutil.rmtree, '/tmp/qubes-test')
vm.kernel = 'dummy' vm.kernel = 'dummy'
libvirt_xml = vm.create_config_file() libvirt_xml = vm.create_config_file()