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

fix(computes): the compute forms save their own kind, a password as typed, and say when the host is not reached

The kind of a compute came from a hidden form field: posted as another
number it was saved, and the edit page of that compute failed. Each form
now saves its own kind. Passwords lost their leading and trailing spaces
on the forms and the API, so a SASL password with one never worked. A
host name whose last label is all digits, such as an IPv4 address with a
trailing dot, was taken and libvirt could not resolve it. A host saved with
a wrong password or not answering was saved silently; the page now says
why the panel cannot connect to it.
This commit is contained in:
catborise 2026-11-12 08:47:32 +03:00
parent d682c4bc82
commit eb3bc69754
10 changed files with 139 additions and 69 deletions

View file

@ -16,6 +16,13 @@ class HostnameValidatorTestCase(unittest.TestCase):
with self.subTest(value=value):
validate_hostname(value)
def test_rejects_what_is_neither_an_address_nor_a_name(self):
# a name's last label is never all digits: libvirt cannot resolve these
for value in ("192.0.2.10.", "192.0.2.1.5", "999.1.1.1"):
with self.subTest(value=value):
with self.assertRaises(ValidationError):
validate_hostname(value)
def test_rejects_uri_and_option_injection(self):
for value in (
"-x",