Commit 39530b23 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'bprescott/20210408-denylist' into 'master'

Remediate use of "blacklist" in push rule check error

See merge request gitlab-org/gitlab!58868
parents 20dd0503 d64478f3
---
title: Change use of "blacklist" to "denylist" in push rule check error
merge_request: 58868
author:
type: changed
......@@ -72,7 +72,7 @@ module EE
if changed_path.new_file? && denylisted_regex = push_rule.filename_denylisted?(changed_path.path)
return unless denylisted_regex.present?
"File name #{changed_path.path} was blacklisted by the pattern #{denylisted_regex}."
"File name #{changed_path.path} was prohibited by the pattern #{denylisted_regex.inspect}."
end
rescue ::PushRule::MatchError => e
raise ::Gitlab::GitAccess::ForbiddenError, e.message
......
......@@ -191,7 +191,7 @@ RSpec.describe Gitlab::Checks::DiffCheck do
it_behaves_like 'check ignored when push rule unlicensed'
it "returns an error if a new or renamed filed doesn't match the file name regex" do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "File name README was blacklisted by the pattern READ*.")
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "File name README was prohibited by the pattern \"READ*\".")
end
it 'returns an error if the regex is invalid' do
......@@ -247,7 +247,7 @@ RSpec.describe Gitlab::Checks::DiffCheck do
project.repository.commits_between(old_rev, new_rev)
)
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /File name #{file_path} was blacklisted by the pattern/)
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /File name #{file_path} was prohibited by the pattern/)
end
end
end
......
......@@ -55,7 +55,7 @@ module QA
expect_error_on_push(file: large_file,
error: 'File "file" is larger than the allowed size of 1 MB')
expect_error_on_push(file: wrongly_named_file,
error: Regexp.escape("File name #{@file_name_limitation} was blacklisted by the pattern #{@file_name_limitation}"))
error: Regexp.escape("File name #{@file_name_limitation} was prohibited by the pattern #{@file_name_limitation}"))
end
it 'restricts users by email format', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/652' do
......@@ -86,7 +86,7 @@ module QA
}]
expect_error_on_push(file: secret_file,
error: Regexp.escape('File name id_rsa was blacklisted by the pattern id_rsa$'))
error: Regexp.escape('File name id_rsa was prohibited by the pattern id_rsa$'))
end
it 'restricts removal of tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/650' do
......
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