diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-09 10:41:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-09 10:41:08 +0000 |
commit | 66f47187da83f122b48b21ff1a8096e0d9f9e7fd (patch) | |
tree | a966c43b1a973a61d362dc7077e24ed12cb52ce3 /lib | |
parent | 877eefdb6d765fd9fd437b8328ecbe00cb07438a (diff) | |
download | gitlab-ce-66f47187da83f122b48b21ff1a8096e0d9f9e7fd.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-7-stable-ee
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/safe_device_detector.rb | 16 |
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 |