Commit 8b8608df authored by Doug Stull's avatar Doug Stull

Change whitelist to allowlist

- more inclusive language
parent 59297396
......@@ -26,7 +26,7 @@ module WorkhorseAuthorization
def file_is_valid?(file)
return false unless file.is_a?(::UploadedFile)
file_extension_whitelist.include?(File.extname(file.original_filename).downcase.delete('.'))
file_extension_allowlist.include?(File.extname(file.original_filename).downcase.delete('.'))
end
def uploader_class
......@@ -37,7 +37,7 @@ module WorkhorseAuthorization
raise NotImplementedError
end
def file_extension_whitelist
def file_extension_allowlist
ImportExportUploader::EXTENSION_ALLOWLIST
end
end
......@@ -3,7 +3,7 @@
class Projects::RequirementsManagement::RequirementsController < Projects::ApplicationController
include WorkhorseAuthorization
EXTENSION_WHITELIST = %w[csv].map(&:downcase).freeze
EXTENSION_ALLOWLIST = %w[csv].map(&:downcase).freeze
before_action :authorize_read_requirement!
before_action :authorize_import_access!, only: [:import_csv, :authorize]
......@@ -44,7 +44,7 @@ class Projects::RequirementsManagement::RequirementsController < Projects::Appli
end
def invalid_file_message
supported_file_extensions = ".#{EXTENSION_WHITELIST.join(', .')}"
supported_file_extensions = ".#{EXTENSION_ALLOWLIST.join(', .')}"
_("The uploaded file was invalid. Supported file extensions are %{extensions}.") % { extensions: supported_file_extensions }
end
......@@ -56,7 +56,7 @@ class Projects::RequirementsManagement::RequirementsController < Projects::Appli
Gitlab::CurrentSettings.max_attachment_size.megabytes
end
def file_extension_whitelist
EXTENSION_WHITELIST
def file_extension_allowlist
EXTENSION_ALLOWLIST
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment