Skip to content

Commit 4807593

Browse files
oatovarbalasankarc
authored andcommitted
Use allowlist and denylist
1 parent b162b36 commit 4807593

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/gitlab/license/analyzer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ class Analyzer
3939
'elkjs', # EPL 2.0 - https://github.com/kieler/elkjs/blob/master/LICENSE.md
4040
]
4141
# readline is GPL licensed and its use was not mere aggregation. Hence it is
42-
# blacklisted.
42+
# denylisted.
4343
# Details: https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1945#note_29286329
4444
@software_unacceptable = ['readline']
4545

4646
def self.software_check(dependency)
4747
if @software_unacceptable.include?(dependency)
48-
['unacceptable', 'Blacklisted software']
48+
['unacceptable', 'Denylisted software']
4949
elsif @software_acceptable.include?(dependency)
50-
['acceptable', 'Whitelisted software']
50+
['acceptable', 'Allowlisted software']
5151
end
5252
end
5353

@@ -82,7 +82,7 @@ def self.status_string(dependency, version, license, status, reason, level)
8282
when 'acceptable'
8383
if reason == 'Acceptable license'
8484
string = "\t" * level + "✓ #{dependency} - #{version} uses #{license} - #{reason}\n"
85-
elsif reason == 'Whitelisted software'
85+
elsif reason == 'Allowlisted software'
8686
string = "\t" * level + "# #{dependency} - #{version} uses #{license} - #{reason}\n"
8787
end
8888
when 'unacceptable'

spec/lib/gitlab/tasks/license_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
expect { Rake::Task['license:check'].invoke }.to output(/✓.*chef-zero - 4.8.0.*Apache-2.0/).to_stdout
3838
end
3939

40-
it 'detects blacklisted softwares with good licenses correctly' do
40+
it 'detects denylisted softwares with good licenses correctly' do
4141
license_info = '[
4242
{
4343
"name": "readline",
@@ -54,7 +54,7 @@
5454
]'
5555
allow(File).to receive(:read).and_return(license_info)
5656

57-
expect { Rake::Task['license:check'].invoke }.to output(/readline.*Blacklisted software/).to_stdout.and raise_error(RuntimeError, "Build Aborted due to license violations")
57+
expect { Rake::Task['license:check'].invoke }.to output(/readline.*Denylisted software/).to_stdout.and raise_error(RuntimeError, "Build Aborted due to license violations")
5858
end
5959

6060
it 'detects bad licenses correctly' do
@@ -77,7 +77,7 @@
7777
expect { Rake::Task['license:check'].invoke }.to output(/foo.*Unacceptable license/).to_stdout.and raise_error(RuntimeError, "Build Aborted due to license violations")
7878
end
7979

80-
it 'detects whitelisted softwares with bad licenses correctly' do
80+
it 'detects allowlisted softwares with bad licenses correctly' do
8181
license_info = '[
8282
{
8383
"name": "git",
@@ -94,10 +94,10 @@
9494
]'
9595
allow(File).to receive(:read).and_return(license_info)
9696

97-
expect { Rake::Task['license:check'].invoke }.to output(/git.*Whitelisted software/).to_stdout
97+
expect { Rake::Task['license:check'].invoke }.to output(/git.*Allowlisted software/).to_stdout
9898
end
9999

100-
it 'detects blacklisted softwares with unknown licenses correctly' do
100+
it 'detects denylisted softwares with unknown licenses correctly' do
101101
license_info = '[
102102
{
103103
"name": "readline",
@@ -114,10 +114,10 @@
114114
]'
115115
allow(File).to receive(:read).and_return(license_info)
116116

117-
expect { Rake::Task['license:check'].invoke }.to output(/readline.*Blacklisted software/).to_stdout.and raise_error(RuntimeError, "Build Aborted due to license violations")
117+
expect { Rake::Task['license:check'].invoke }.to output(/readline.*Denylisted software/).to_stdout.and raise_error(RuntimeError, "Build Aborted due to license violations")
118118
end
119119

120-
it 'detects whitelisted software with unknown licenses correctly' do
120+
it 'detects allowlisted software with unknown licenses correctly' do
121121
license_info = '[
122122
{
123123
"name": "git",
@@ -133,7 +133,7 @@
133133
}
134134
]'
135135
allow(File).to receive(:read).and_return(license_info)
136-
expect { Rake::Task['license:check'].invoke }.to output(/git.*Whitelisted software/).to_stdout
136+
expect { Rake::Task['license:check'].invoke }.to output(/git.*Allowlisted software/).to_stdout
137137
end
138138

139139
it 'should detect if install directory not found' do

0 commit comments

Comments
 (0)