mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 19:56:48 +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
|
|
@ -15,12 +15,8 @@ class wvmSecrets(wvmConnect):
|
|||
etree.SubElement(usage, USAGE_ELEMENTS[secret_type]).text = data
|
||||
self.wvm.secretDefineXML(etree.tostring(secret, encoding="unicode"))
|
||||
|
||||
def get_secret_value(self, uuid):
|
||||
"""The value as base64 text, the form set_secret_value takes."""
|
||||
secrt = self.get_secret(uuid)
|
||||
return base64.b64encode(secrt.value()).decode()
|
||||
|
||||
def set_secret_value(self, uuid, value):
|
||||
"""value: the new value as base64 text."""
|
||||
secrt = self.get_secret(uuid)
|
||||
# validate: a value that is not base64 is refused, not decoded to other bytes
|
||||
secrt.setValue(base64.b64decode(value, validate=True))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue