Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-09 13:41:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-09 13:41:08 +0300
commit66f47187da83f122b48b21ff1a8096e0d9f9e7fd (patch)
treea966c43b1a973a61d362dc7077e24ed12cb52ce3 /lib
parent877eefdb6d765fd9fd437b8328ecbe00cb07438a (diff)
Add latest changes from gitlab-org/security/gitlab@15-7-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/safe_device_detector.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/safe_device_detector.rb b/lib/gitlab/safe_device_detector.rb
new file mode 100644
index 00000000000..ba1010ae5e4
--- /dev/null
+++ b/lib/gitlab/safe_device_detector.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+# rubocop:disable Gitlab/NamespacedClass
+require 'device_detector'
+
+module Gitlab
+ class SafeDeviceDetector < ::DeviceDetector
+ USER_AGENT_MAX_SIZE = 1024
+
+ def initialize(user_agent)
+ super(user_agent)
+ @user_agent = user_agent && user_agent[0..USER_AGENT_MAX_SIZE]
+ end
+ end
+end
+
+# rubocop:enable Gitlab/NamespacedClass