summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 21e2e21e9b3..5bddf45341c 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -229,7 +229,13 @@ class CommitStatus < Ci::ApplicationRecord
end
def group_name
- name.to_s.sub(%r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z}, '').strip
+ # [\b\s:] -> whitespace or column
+ # (\[.*\])|(\d+[\s:\/\\]+\d+) -> variables/matrix or parallel-jobs numbers
+ # {1,3} -> number of times that matches the variables/matrix or parallel-jobs numbers
+ # we limit this to 3 because of possible abuse
+ regex = %r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+))){1,3}\s*\z}
+
+ name.to_s.sub(regex, '').strip
end
def failed_but_allowed?