mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat(security): enforce require_POST on power actions, prevent open redirects, and isolate instance permissions
This commit is contained in:
parent
3f8eeb04bd
commit
b3e6fb2b7a
9 changed files with 383 additions and 63 deletions
|
|
@ -20,10 +20,9 @@ def get_user_totp_device(user):
|
|||
|
||||
|
||||
def validate_ssh_key(key):
|
||||
array = key.encode().split()
|
||||
# Each rsa-ssh key has 3 different strings in it, first one being
|
||||
# typeofkey second one being keystring third one being username .
|
||||
if len(array) != 3:
|
||||
array = key.strip().encode().split()
|
||||
# An OpenSSH public key has 2 parts (type, key) or 3 parts (type, key, comment).
|
||||
if len(array) not in (2, 3):
|
||||
return False
|
||||
typeofkey = array[0]
|
||||
string = array[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue