mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(virtsecrets): a secret's value never reaches the page
The edit dialog of a secret was filled with its current value, so every readable secret's value was in the secrets page's HTML. A private secret, or one with no value yet, cannot be read: its field held the text "None", which is valid base64, and saving the dialog unchanged set the secret to the three bytes it decodes to. The dialog now only writes a new value: the field starts empty, is a password field and is required. The page no longer reads secret values, and get_secret_value, used only for that, is gone.
This commit is contained in:
parent
ce7c772aae
commit
4ece22230e
5 changed files with 35 additions and 16 deletions
|
|
@ -35,12 +35,9 @@ class SecretValueTests(SimpleTestCase):
|
|||
secret = get.return_value.secretLookupByUUIDString.return_value
|
||||
return conn, secret
|
||||
|
||||
def test_the_shown_value_written_back_keeps_the_secret(self):
|
||||
def test_a_base64_value_is_stored_as_its_bytes(self):
|
||||
conn, secret = self.secrets()
|
||||
secret.value.return_value = b"pw\x00\xff"
|
||||
shown = conn.get_secret_value("uuid")
|
||||
self.assertEqual(shown, "cHcA/w==") # base64 text, what the edit dialog shows
|
||||
conn.set_secret_value("uuid", shown)
|
||||
conn.set_secret_value("uuid", "cHcA/w==")
|
||||
secret.setValue.assert_called_once_with(b"pw\x00\xff")
|
||||
|
||||
def test_a_value_that_is_not_base64_is_refused(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue