From d5cf27e667e86b023f60780a4e9cdd5d3d1babfd Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Sep 2024 11:40:18 +0200 Subject: [PATCH] Add global Regexp timeout (#31928) --- config/initializers/regexp.rb | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 config/initializers/regexp.rb diff --git a/config/initializers/regexp.rb b/config/initializers/regexp.rb new file mode 100644 index 00000000000..a820d2b5d3d --- /dev/null +++ b/config/initializers/regexp.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +# 0.5s is a fairly high timeout, but that should account for slow servers under load +Regexp.timeout = 0.5 if Regexp.respond_to?(:timeout=)