From 1660362499dd0873609dbc9019f81dbd590e8918 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 13 Dec 2022 15:50:47 +0800 Subject: [PATCH] perf: validate ssh key --- apps/common/utils/encode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/utils/encode.py b/apps/common/utils/encode.py index 9eefde044..36cd4f224 100644 --- a/apps/common/utils/encode.py +++ b/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):