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

fix(instances): the root password and SSH key a setting turns off are refused

Settings > "Show Root Password" and "Show SSH Keys" hid their forms on
the Access tab, but an owner who may change the VM could still post to
them and reset its root password or install a key. Both are now refused
while their setting is off.

A password longer than 4096 characters or with a NUL character, which
passlib does not hash, ended in a 500; it is now refused with a message.
This commit is contained in:
catborise 2026-11-13 08:09:17 +03:00
parent 8e990e7d1a
commit 87f7100fc9
9 changed files with 306 additions and 253 deletions

View file

@ -9,6 +9,7 @@ from django.contrib.messages import get_messages
from django.test import TestCase
from django.urls import reverse
from appsettings.models import AppSettings
from computes.models import Compute
from instances.models import Instance
from logs.models import Logs
@ -16,6 +17,7 @@ from logs.models import Logs
class MissingFieldTestCase(TestCase):
def setUp(self):
AppSettings.objects.filter(key__startswith="SHOW_ACCESS_").update(value="True") # the Access forms are on
self.client.force_login(get_user_model().objects.create_superuser("mf", "mf@example.com", "pw"))
Logs.objects.all().delete() # the login's row
self.compute = Compute.objects.create(name="mf-c", hostname="127.0.0.1", login="", password="", type=4)