oVirt/go-ovirt-client

Values need to be XML encoded before being sent to oVirt's API

hotspoons opened this issue · 0 comments

Describe the bug

A downstream project (oVirt Terraform provider) uses this library / application to handle communications with the oVirt API. Today when trying to get it to function with a custom initialization script, I struggled for several hours trying to figure out why I couldn't get a VM to properly execute an initialization script.

The biggest issue I ran into was that this library does not XML entity encode values provided to the oVirt API, so if there is a reserved XML token in something like a shell command, it fails the entire request.

To Reproduce

provide the value

runcmd: 
  - echo "blah" > /tmp/blah.txt && sleep 1

to the customScript property, I guarantee it will break the request. I don't know how to do that directly here, but I left some terraform/hcl in a documentation request in the other project here

Expected behavior

Any arbitrary value passed in the customScript property should not break the request, the value should be properly encoded/escaped.