1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
Commit graph

4 commits

Author SHA1 Message Date
catborise
4ece22230e 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.
2026-10-20 22:37:36 +03:00
catborise
f4cdd91210 fix(virtsecrets): saving a secret's value unchanged keeps it
get_secret_value returned bytes, so the edit dialog showed b'cHc=' (the
bytes' repr) for the base64 value cHc=. Saving the dialog as shown fed
"b'cHc='" to b64decode, which dropped the quotes and the b and stored
other bytes: the secret silently changed (pw became m\xc1\xdc). The value
is now base64 text, and set_secret_value decodes with validate=True, so
a value that is not base64 is refused with a message instead. The field
had an invalid pattern ([a-zA-Z0-9]$+, ignored by browsers) and a 45
character limit; it takes base64 of any length.
2026-10-19 21:17:44 +03:00
catborise
66151d42b1 fix(virtsecrets): a secret's usage value goes into its XML as text
create_secret wrote the usage value into the secret XML with an f-string,
unchecked: a quote, "<" or "&" broke the XML or added to it. The page's
pattern ([a-z0-9. ]+) was the only check and refused real values: a
volume secret's path ("/") and an iSCSI IQN ("-", ":"). The XML is now
built with lxml, so the value is text whatever it holds, and the input
keeps only required and the form's 100 characters; libvirt reports a
value it does not take.

A live test creates a volume, an iSCSI and a Ceph secret with real
values through the page.
2026-10-19 16:43:06 +03:00
catborise
5aa22ac042 Django 3.2.4 LTS upgrade 2021-06-15 13:28:47 +03:00
Renamed from vrtManager/secrets.py (Browse further)