Browse Source

perf: validate ssh key

pull/9202/head
feng 2 years ago
parent
commit
1660362499
  1. 4
      apps/common/utils/encode.py

4
apps/common/utils/encode.py

@ -190,8 +190,8 @@ def _parse_ssh_private_key(text, password=None):
if is_openssh_format_key(text):
return serialization.load_ssh_private_key(text, password=password)
return serialization.load_pem_private_key(text, password=password)
except (ValueError, TypeError) as e:
raise e
except (ValueError, TypeError):
return None
def is_openssh_format_key(text: bytes):

Loading…
Cancel
Save