From b32db6f2a3330c5cd5dfdcdd228843ecec0ef9b1 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 25 Jan 2023 18:55:01 +0200 Subject: [PATCH] SECURITY: Prevent ReDOS by making the SSH url regex unambiguous (#20000) Co-authored-by: Daniel Waterworth --- lib/git_url.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git_url.rb b/lib/git_url.rb index d1980a94de7..f991d585c2c 100644 --- a/lib/git_url.rb +++ b/lib/git_url.rb @@ -2,7 +2,7 @@ module GitUrl class << self - SSH_REGEXP = /(\w+@(\w+\.)*\w+):(.*)/ + SSH_REGEXP = /\A(\w+@\w+(\.\w+)*):(.*)\z/ def normalize(url) if m = SSH_REGEXP.match(url)