From cad46a3e97da64d07c4cf677e8921c11db993357 Mon Sep 17 00:00:00 2001 From: Xander Bil Date: Sun, 2 Jun 2024 23:35:24 +0200 Subject: [PATCH] update ssh_key regex --- src/models/user.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/models/user.rs b/src/models/user.rs index cba287e..80d5a61 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -577,7 +577,16 @@ fn validate_ssh_key_list( ) -> std::result::Result<(), ValidationError> { lazy_static! { static ref SSH_KEY_REGEX: Regex = Regex::new( - r"ssh-(rsa|dsa|ecdsa|ed25519) [a-zA-Z0-9+/]{1,750}={0,3}( [^ ]+)?" + r"(?x)^ + ( + ssh-(rsa|dss|ecdsa|ed25519)| + ecdsa-sha2-nistp(256|384|521)| + sk-( + ecdsa-sha2-nistp256@openssh.com| + ssh-ed25519@openssh.com + ) + ) + \s[a-zA-Z0-9+/]{1,750}={0,3}( \S+)?" ) .unwrap(); }