diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /lib/gitlab/sanitizers | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'lib/gitlab/sanitizers')
-rw-r--r-- | lib/gitlab/sanitizers/exception_message.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/sanitizers/exif.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/sanitizers/svg.rb | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/gitlab/sanitizers/exception_message.rb b/lib/gitlab/sanitizers/exception_message.rb index 11c91093d88..27885c27ee0 100644 --- a/lib/gitlab/sanitizers/exception_message.rb +++ b/lib/gitlab/sanitizers/exception_message.rb @@ -4,8 +4,8 @@ module Gitlab module Sanitizers module ExceptionMessage FILTERED_STRING = '[FILTERED]' - EXCEPTION_NAMES = %w(URI::InvalidURIError Addressable::URI::InvalidURIError).freeze - MESSAGE_REGEX = %r{(\A[^:]+:\s).*\Z}.freeze + EXCEPTION_NAMES = %w[URI::InvalidURIError Addressable::URI::InvalidURIError].freeze + MESSAGE_REGEX = %r{(\A[^:]+:\s).*\Z} class << self def clean(exception_name, message) diff --git a/lib/gitlab/sanitizers/exif.rb b/lib/gitlab/sanitizers/exif.rb index e302729df66..93deb97c841 100644 --- a/lib/gitlab/sanitizers/exif.rb +++ b/lib/gitlab/sanitizers/exif.rb @@ -4,7 +4,7 @@ module Gitlab module Sanitizers class Exif # these tags are not removed from the image - WHITELISTED_TAGS = %w( + WHITELISTED_TAGS = %w[ ResolutionUnit XResolution YResolution @@ -17,13 +17,13 @@ module Gitlab Copyright CopyrightNotice Orientation - ).freeze + ].freeze # these tags are common in exiftool output, these # do not contain any sensitive information, but # we don't need to preserve them when removing # exif tags - IGNORED_TAGS = %w( + IGNORED_TAGS = %w[ ColorComponents EncodingProcess ExifByteOrder @@ -41,11 +41,11 @@ module Gitlab FileType FileTypeExtension MIMEType - ).freeze + ].freeze ALLOWED_TAGS = WHITELISTED_TAGS + IGNORED_TAGS EXCLUDE_PARAMS = WHITELISTED_TAGS.map { |tag| "-#{tag}" } - ALLOWED_MIME_TYPES = %w(image/jpeg image/tiff).freeze + ALLOWED_MIME_TYPES = %w[image/jpeg image/tiff].freeze attr_reader :logger diff --git a/lib/gitlab/sanitizers/svg.rb b/lib/gitlab/sanitizers/svg.rb index 98f78c5e74b..0d4e6be2129 100644 --- a/lib/gitlab/sanitizers/svg.rb +++ b/lib/gitlab/sanitizers/svg.rb @@ -9,7 +9,7 @@ module Gitlab class Scrubber < Loofah::Scrubber # http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data-with-the-data-*-attributes - DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u.freeze + DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u def scrub(node) unless Whitelist::ALLOWED_ELEMENTS.include?(node.name) |