Bug 26681 - Überprüfen auf gültige VM- und Pfadnamen
Überprüfen auf gültige VM- und Pfadnamen
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Virtualization - UVMM
UCS 2.4
Other Linux
: P5 normal (vote)
: UCS 3.1
Assigned To: Philipp Hahn
Janek Walkenhorst
: interim-3
Depends on: 22945
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-30 16:10 CEST by Philipp Hahn
Modified: 2012-12-12 21:10 CET (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Troubleshooting
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2012-03-30 16:10:02 CEST
+++ This bug was initially created as a clone of Bug #22945 +++
Der / sollte escapt oder zumindest in der Eingabemaske nicht erlaubt werden.


Allgemein sollten die eingegebenen Namen besser validiert werden:
1. Unter KVM werden die VM-Namen auch als Dateinamen verwendet, dort sollte '/' und iscntrl() und '.' am Anfang verweigert werden.
2. Unter XEN ist bereits eine Beschränkung des Namens implementiert.
3. Für Storage-Volumes sollte das gleiche wie unter 1. implementiert werden.

Intern hatten wir gerade aus isala das Problem, das dort ein Image  /var/lib/libvirt/images/jebersba_jceb-21.120-ucs2.4-master^[\D^[\[D^[\[D^[\[D^[\[D^[\[D^[\[D^[\[.qcow2 den Storage-Pool unbrauchbar gemacht hat, weil der minidom-XML-Parser nicht mit den Steuerzeichen zurecht kommt:

2012-03-30 15:01:46,021 - uvmmd.unix - ERROR - [617] Exception: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/uvmm/unix.py", line 149, in handle_command
    res = cmd(self, command)
  File "/usr/lib/pymodules/python2.6/univention/uvmm/commands.py", line 383, in STORAGE_VOLUMES
    volumes = storage.get_storage_volumes(node_stat, request.pool, request.type)
  File "/usr/lib/pymodules/python2.6/univention/uvmm/storage.py", line 210, in get_storage_volumes
    doc = parseString( xml )
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
ExpatError: not well-formed (invalid token): line 2, column 42

Entstanden war das ganze durch ucs-kt-get, wo aus Versehen die Pfeil-nach-links-Taste gedrückt wurde und wegen fehlender readline-Unterstützung dann die Escape-Sequenz eingefügt hat.
Ggf. sollte UVMM auch hier besser mit Fehlern umgehen, die durch direkte Verwendung von virsh entstehen.
Comment 1 Philipp Hahn univentionstaff 2012-11-06 14:08:34 CET
Erneut intern auf odda aufgetreten:

2012-11-06 13:50:26,212 - uvmmd.unix - ERROR - [1088] Exception: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/uvmm/unix.py", line 149, in handle_command
    res = cmd(self, command)
  File "/usr/lib/pymodules/python2.6/univention/uvmm/commands.py", line 383, in STORAGE_VOLUMES
    volumes = storage.get_storage_volumes(node_stat, request.pool, request.type)
  File "/usr/lib/pymodules/python2.6/univention/uvmm/storage.py", line 210, in get_storage_volumes
    doc = parseString( xml )
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
ExpatError: not well-formed (invalid token): line 2, column 16

>>> print repr(xml)
"<volume>\n  <name>modabas_\x1b[B\x1b[Abackup2.4-nfsv4.qcow2</name>

Das sollte sowohl in ucs-kt-get abgefangen werden, alsauch innerhalb von UVMMd abgefangen und ignoriert werden.
Comment 2 Philipp Hahn univentionstaff 2012-11-07 15:48:13 CET
An den Stellen, wo XML Daten verarbeitet werden, die potentiellen User-Input enthalten, wird nun jeweils die Ausnahme ExpatError abgefangen und die Verarbeitung ohne diese Inofrmation (so weit wie möglich) fortgesetzt.

svn11075, univention-virtual-machine-manager-daemon_2.0.16-1.406.201211071545
ChangeLog: svn15508
\item Invalid XML data is storage volume and domain information is now silently ignored (\ucsBug{26681}).

Die Änderung an den ucs-kt-Tools steht noch aus.
Comment 3 Janek Walkenhorst univentionstaff 2012-11-21 17:50:26 CET
Images mit Steuerzeichen werden einfach nicht aufgelistet und führen ansonsten zu keinen Problemen.

Changelog OK
Comment 4 Stefan Gohmann univentionstaff 2012-12-12 21:10:31 CET
UCS 3.1-0 has been released: 
 http://forum.univention.de/viewtopic.php?f=54&t=2125

If this error occurs again, please use "Clone This Bug".