Skip to content

Commit

Permalink
Rename whitelist to allowlist in code
Browse files Browse the repository at this point in the history
Rename the terms whitelist/blacklist in code and comments to
allowlist/denylist.

Note: Not changing the `whitelist_file` DSL term in this commit as it is a
breaking change. It will be done in a separate commit.

Signed-off-by: Balasankar "Balu" C <[email protected]>
  • Loading branch information
balasankarc committed Aug 16, 2021
1 parent e3573e7 commit 0efd9b5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions lib/omnibus/whitelist.rb → lib/omnibus/allowlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

WHITELIST_LIBS = [
ALLOWLIST_LIBS = [
/ld-linux/,
/libanl\.so/,
/libc\.so/,
Expand All @@ -33,7 +33,7 @@
/linux-gate\.so/,
].freeze

ARCH_WHITELIST_LIBS = [
ARCH_ALLOWLIST_LIBS = [
/libanl\.so/,
/libc\.so/,
/libcrypt\.so/,
Expand All @@ -48,7 +48,7 @@
/libutil\.so/,
].freeze

AIX_WHITELIST_LIBS = [
AIX_ALLOWLIST_LIBS = [
/libpthread\.a/,
/libpthreads\.a/,
/libdl.a/,
Expand All @@ -58,7 +58,7 @@
/unix$/,
].freeze

OMNIOS_WHITELIST_LIBS = [
OMNIOS_ALLOWLIST_LIBS = [
/libc\.so\.1/,
/libcrypt\./,
/libcrypt\.so\.1/,
Expand All @@ -79,7 +79,7 @@
/libgcc_s\.so\.1/,
].freeze

SOLARIS_WHITELIST_LIBS = [
SOLARIS_ALLOWLIST_LIBS = [
/libaio\.so/,
/libavl\.so/,
/libcrypt_[di]\.so/,
Expand Down Expand Up @@ -119,7 +119,7 @@
/s9_preload\.so\.1/,
].freeze

SMARTOS_WHITELIST_LIBS = [
SMARTOS_ALLOWLIST_LIBS = [
/libm.so/,
/libpthread.so/,
/librt.so/,
Expand All @@ -141,7 +141,7 @@
/libz\.so/, # while we package our own libz, this get dragged along from Solaris 11's libelf library for some reason...
].freeze

MAC_WHITELIST_LIBS = [
MAC_ALLOWLIST_LIBS = [
/libobjc\.A\.dylib/,
/libSystem\.B\.dylib/,
/CoreFoundation/,
Expand All @@ -165,7 +165,7 @@
/SystemConfiguration/,
].freeze

FREEBSD_WHITELIST_LIBS = [
FREEBSD_ALLOWLIST_LIBS = [
/libc\.so/,
/libgcc_s\.so/,
/libcrypt\.so/,
Expand Down
2 changes: 1 addition & 1 deletion lib/omnibus/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
require "ostruct" unless defined?(OpenStruct)
require "pathname" unless defined?(Pathname)
require "omnibus/whitelist"
require "omnibus/allowlist"

module Omnibus
class Builder
Expand Down
26 changes: 13 additions & 13 deletions lib/omnibus/health_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

require "omnibus/sugarable"
require "omnibus/whitelist"
require "omnibus/allowlist"
begin
require "pedump"
rescue LoadError
Expand Down Expand Up @@ -380,7 +380,7 @@ def hex
end

#
# The list of whitelisted (ignored) files from the project and softwares.
# The list of allowed (ignored) files from the project and softwares.
#
# @return [Array<String, Regexp>]
#
Expand Down Expand Up @@ -423,26 +423,26 @@ def read_shared_libs(command)
def check_for_bad_library(bad_libs, current_library, name, linked)
safe = nil

whitelist_libs = case Ohai["platform"]
allowlist_libs = case Ohai["platform"]
when "arch"
ARCH_WHITELIST_LIBS
ARCH_ALLOWLIST_LIBS
when "mac_os_x"
MAC_WHITELIST_LIBS
MAC_ALLOWLIST_LIBS
when "omnios"
OMNIOS_WHITELIST_LIBS
OMNIOS_ALLOWLIST_LIBS
when "solaris2"
SOLARIS_WHITELIST_LIBS
SOLARIS_ALLOWLIST_LIBS
when "smartos"
SMARTOS_WHITELIST_LIBS
SMARTOS_ALLOWLIST_LIBS
when "freebsd"
FREEBSD_WHITELIST_LIBS
FREEBSD_ALLOWLIST_LIBS
when "aix"
AIX_WHITELIST_LIBS
AIX_ALLOWLIST_LIBS
else
WHITELIST_LIBS
ALLOWLIST_LIBS
end

whitelist_libs.each do |reg|
allowlist_libs.each do |reg|
safe ||= true if reg.match(name)
end

Expand All @@ -463,7 +463,7 @@ def check_for_bad_library(bad_libs, current_library, name, linked)
bad_libs[current_library][name][linked] = 1
end
else
log.debug(log_key) { " -> PASSED: #{name} is either whitelisted or safely provided." }
log.debug(log_key) { " -> PASSED: #{name} is either allowed or safely provided." }
end

bad_libs
Expand Down
2 changes: 1 addition & 1 deletion lib/omnibus/licensing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def local?(license)
# Logs the given message as info.
#
# This method should only be used for detecting in a license is known or not.
# In the future, we will introduce a configurable way to whitelist or blacklist
# In the future, we will introduce a configurable way to allow or reject
# the allowed licenses. Once we implement that we need to stop using this method.
#
# @param [String] message
Expand Down
4 changes: 2 additions & 2 deletions lib/omnibus/software.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def version(val = NULL, &block)
expose :version

#
# Add a file to the healthcheck whitelist.
# Add a file to the healthcheck allowlist.
#
# @example
# whitelist_file '/path/to/file'
Expand All @@ -546,7 +546,7 @@ def version(val = NULL, &block)
# the name of a file to ignore in the healthcheck
#
# @return [Array<String>]
# the list of currently whitelisted files
# the list of currently allowed files
#
def whitelist_file(file)
file = Regexp.new(file) unless file.is_a?(Regexp)
Expand Down

0 comments on commit 0efd9b5

Please sign in to comment.