1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(instances): a VNC password the browser console can send, kept as set

The console settings accepted any password of at most 8 bytes, so "éééé"
was saved, but noVNC derives its key from the characters while QEMU
compares the UTF-8 bytes: the browser console could not log in. A new
password now takes up to 8 printable ASCII characters, which also keeps
control characters out of the definition.

The .vv file wrote the password and the VM name as they are; virt-viewer
reads it as a GLib key file, so a backslash or a leading space changed
the password. Both are escaped as a key file expects.

A new or removed password also drops a passwdValidTo set elsewhere: an
expired one left the new password unusable.
This commit is contained in:
catborise 2026-11-13 22:26:02 +03:00
parent 275bf11aed
commit cd3edf4dff
11 changed files with 257 additions and 222 deletions

View file

@ -71,9 +71,10 @@ class CanOpenConsoleTestCase(TestCase):
self.owner.user_permissions.add(Permission.objects.get(codename="passwordless_console"))
with patch("instances.models.wvmInstance") as wvm:
proxy = wvm.return_value.cached_reads.return_value.__enter__.return_value
proxy.get_console_passwd.return_value = "secret"
proxy.get_console_passwd.return_value = " a\\nb"
res = self.client.get(reverse("instances:getvvfile", args=[self.instance.id]))
self.assertIn(b"password=secret\n", res.content)
# as a key file reads it back: the leading space and the backslash stay
self.assertIn(b"password=\\sa\\\\nb\n", res.content)
def test_owner_can_get_vdi_url(self):
self.client.force_login(self.owner)