A platform for community discussion. Free, open, simple.
FIX: use allowlist and blocklist terminology (#10209)
Krzysztof Kotlareke0d9232259f6
diff --git a/Gemfile.lock b/Gemfile.lockindex c4126f88a61..7f65dcb6f0b 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -240,7 +240,7 @@ GEMomniauth-twitter (1.4.0)omniauth-oauth (~> 1.1)rack- onebox (1.9.30)+ onebox (2.0.0)addressable (~> 2.7.0)htmlentities (~> 4.3)multi_json (~> 1.11)diff --git a/app/assets/javascripts/admin/components/embeddable-host.js b/app/assets/javascripts/admin/components/embeddable-host.jsindex cc96741fed2..d67a236aa4c 100644--- a/app/assets/javascripts/admin/components/embeddable-host.js+++ b/app/assets/javascripts/admin/components/embeddable-host.js@@ -42,7 +42,7 @@ export default Component.extend(bufferedProperty("host"), {const props = this.buffered.getProperties("host",- "path_whitelist",+ "allowed_paths","class_name");props.category_id = this.categoryId;diff --git a/app/assets/javascripts/admin/components/screened-ip-address-form.js b/app/assets/javascripts/admin/components/screened-ip-address-form.jsindex 9bd2323b6f9..ca535d05f3a 100644--- a/app/assets/javascripts/admin/components/screened-ip-address-form.js+++ b/app/assets/javascripts/admin/components/screened-ip-address-form.js@@ -3,7 +3,7 @@ import discourseComputed from "discourse-common/utils/decorators";import { schedule } from "@ember/runloop";import Component from "@ember/component";/**- A form to create an IP address that will be blocked or whitelisted.+ A form to create an IP address that will be blocked or allowed.Example usage:{{screened-ip-address-form action=(action "recordAdded")}}@@ -21,9 +21,9 @@ export default Component.extend({formSubmitted: false,actionName: "block",- @discourseComputed("siteSettings.use_admin_ip_whitelist")- actionNames(adminWhitelistEnabled) {- if (adminWhitelistEnabled) {+ @discourseComputed("siteSettings.use_admin_ip_allowlist")+ actionNames(adminAllowlistEnabled) {+ if (adminAllowlistEnabled) {return [{ id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") },{diff --git a/app/assets/javascripts/admin/templates/components/embeddable-host.hbs b/app/assets/javascripts/admin/templates/components/embeddable-host.hbsindex 9c418be5ebf..7d73d93a2b3 100644--- a/app/assets/javascripts/admin/templates/components/embeddable-host.hbs+++ b/app/assets/javascripts/admin/templates/components/embeddable-host.hbs@@ -8,8 +8,8 @@{{input value=buffered.class_name placeholder="class" enter=(action "save") class="class-name"}}</td><td class="editing-input">- <div class="label">{{i18n "admin.embedding.path_whitelist"}}</div>- {{input value=buffered.path_whitelist placeholder="/blog/.*" enter=(action "save") class="path-whitelist"}}+ <div class="label">{{i18n "admin.embedding.allowed_paths"}}</div>+ {{input value=buffered.allowed_paths placeholder="/blog/.*" enter=(action "save") class="path-allowlist"}}</td><td class="editing-input"><div class="label">{{i18n "admin.embedding.category"}}</div>@@ -26,7 +26,7 @@{{else}}<td><div class="label">{{i18n "admin.embedding.host"}}</div>{{host.host}}</td><td><div class="label">{{i18n "admin.embedding.class_name"}}</div>{{host.class_name}}</td>- <td><div class="label">{{i18n "admin.embedding.path_whitelist"}}</div>{{host.path_whitelist}}</td>+ <td><div class="label">{{i18n "admin.embedding.allowed_paths"}}</div>{{host.allowed_paths}}</td><td><div class="label">{{i18n "admin.embedding.category"}}</div>{{category-badge host.category}}</td><td class="controls">{{d-button icon="pencil-alt" action=(action "edit")}}diff --git a/app/assets/javascripts/admin/templates/embedding.hbs b/app/assets/javascripts/admin/templates/embedding.hbsindex b70a9be306f..fc07050e346 100644--- a/app/assets/javascripts/admin/templates/embedding.hbs+++ b/app/assets/javascripts/admin/templates/embedding.hbs@@ -4,7 +4,7 @@<thead><th style="width: 25%">{{i18n "admin.embedding.host"}}</th><th style="width: 15%">{{i18n "admin.embedding.class_name"}}</th>- <th style="width: 25%">{{i18n "admin.embedding.path_whitelist"}}</th>+ <th style="width: 25%">{{i18n "admin.embedding.allowed_paths"}}</th><th style="width: 25%">{{i18n "admin.embedding.category"}}</th><th style="width: 10%"> </th></thead>@@ -45,16 +45,16 @@<h3>{{i18n "admin.embedding.crawling_settings"}}</h3><p class="description">{{i18n "admin.embedding.crawling_description"}}</p>- {{embedding-setting field="embed_whitelist_selector"- value=embedding.embed_whitelist_selector+ {{embedding-setting field="allowed_embed_selectors"+ value=embedding.allowed_embed_selectorsplaceholder="article, #story, .post"}}- {{embedding-setting field="embed_blacklist_selector"- value=embedding.embed_blacklist_selector+ {{embedding-setting field="blocked_embed_selectors"+ value=embedding.blocked_embed_selectorsplaceholder=".ad-unit, header"}}- {{embedding-setting field="embed_classname_whitelist"- value=embedding.embed_classname_whitelist+ {{embedding-setting field="allowed_embed_classnames"+ value=embedding.allowed_embed_classnamesplaceholder="emoji, classname"}}</div>diff --git a/app/assets/javascripts/discourse/app/lib/to-markdown.js b/app/assets/javascripts/discourse/app/lib/to-markdown.jsindex 25e49bfc85f..43f97659776 100644--- a/app/assets/javascripts/discourse/app/lib/to-markdown.js+++ b/app/assets/javascripts/discourse/app/lib/to-markdown.js@@ -102,7 +102,7 @@ export class Tag {];}- static whitelists() {+ static allowedTags() {return ["ins", "del", "small", "big", "kbd", "ruby", "rt", "rb", "rp"];}@@ -192,7 +192,7 @@ export class Tag {};}- static whitelist(name) {+ static allowedTag(name) {return class extends Tag {constructor() {super(name, `<${name}>`, `</${name}>`);@@ -526,7 +526,7 @@ function tags() {...Tag.headings().map((h, i) => Tag.heading(h, i + 1)),...Tag.slices().map(s => Tag.slice(s, "\n")),...Tag.emphases().map(e => Tag.emphasis(e[0], e[1])),- ...Tag.whitelists().map(t => Tag.whitelist(t)),+ ...Tag.allowedTags().map(t => Tag.allowedTag(t)),Tag.aside(),Tag.cell("td"),Tag.cell("th"),diff --git a/app/assets/javascripts/discourse/app/templates/preferences/categories.hbs b/app/assets/javascripts/discourse/app/templates/preferences/categories.hbsindex cd907dc0ed9..7b36d0f3ffd 100644--- a/app/assets/javascripts/discourse/app/templates/preferences/categories.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences/categories.hbs@@ -8,7 +8,7 @@{{/if}}{{category-selectorcategories=model.watchedCategories- blacklist=selectedCategories+ blocklist=selectedCategoriesonChange=(action (mut model.watchedCategories))}}</div>@@ -21,7 +21,7 @@{{/if}}{{category-selectorcategories=model.trackedCategories- blacklist=selectedCategories+ blocklist=selectedCategoriesonChange=(action (mut model.trackedCategories))}}</div>@@ -31,7 +31,7 @@<label>{{d-icon "d-watching-first"}} {{i18n "user.watched_first_post_categories"}}</label>{{category-selectorcategories=model.watchedFirstPostCategories- blacklist=selectedCategories+ blocklist=selectedCategoriesonChange=(action (mut model.watchedFirstPostCategories))}}</div>@@ -45,7 +45,7 @@{{/if}}{{category-selectorcategories=model.mutedCategories- blacklist=selectedCategories+ blocklist=selectedCategoriesonChange=(action (mut model.mutedCategories))}}</div>diff --git a/app/assets/javascripts/discourse/app/templates/preferences/tags.hbs b/app/assets/javascripts/discourse/app/templates/preferences/tags.hbsindex 85973fb5fba..3eb66ff86ac 100644--- a/app/assets/javascripts/discourse/app/templates/preferences/tags.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences/tags.hbs@@ -6,7 +6,7 @@<label>{{d-icon "d-watching" class="icon watching"}} {{i18n "user.watched_tags"}}</label>{{tag-choosertags=model.watched_tags- blacklist=selectedTags+ blocklist=selectedTagsallowCreate=falseeveryTag=trueunlimitedTagCount=true@@ -19,7 +19,7 @@<label>{{d-icon "d-tracking" class="icon tracking"}} {{i18n "user.tracked_tags"}}</label>{{tag-choosertags=model.tracked_tags- blacklist=selectedTags+ blocklist=selectedTagsallowCreate=falseeveryTag=trueunlimitedTagCount=true}}@@ -31,7 +31,7 @@<label>{{d-icon "d-watching-first" class="icon watching-first-post"}} {{i18n "user.watched_first_post_tags"}}</label>{{tag-choosertags=model.watching_first_post_tags- blacklist=selectedTags+ blocklist=selectedTagsallowCreate=falseeveryTag=trueunlimitedTagCount=true}}@@ -45,7 +45,7 @@<label>{{d-icon "d-muted" class="icon muted"}} {{i18n "user.muted_tags"}}</label>{{tag-choosertags=model.muted_tags- blacklist=selectedTags+ blocklist=selectedTagsallowCreate=falseeveryTag=trueunlimitedTagCount=true}}diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.jsindex ca55984242d..ba945ccd647 100644--- a/app/assets/javascripts/discourse/app/widgets/header.js+++ b/app/assets/javascripts/discourse/app/widgets/header.js@@ -514,12 +514,12 @@ export default createWidget("header", {const currentPath = this.register.lookup("service:router").get("_router.currentPath");- const blacklist = [/^discovery\.categories/];- const whitelist = [/^topic\./];+ const blocklist = [/^discovery\.categories/];+ const allowlist = [/^topic\./];const check = function(regex) {return !!currentPath.match(regex);};- let showSearch = whitelist.any(check) && !blacklist.any(check);+ let showSearch = allowlist.any(check) && !blocklist.any(check);// If we're viewing a topic, only intercept search if there are cloaked postsif (showSearch && currentPath.match(/^topic\./)) {diff --git a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.jsindex 1a5f50a6dea..38414140c70 100644--- a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js+++ b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js@@ -389,7 +389,7 @@ export function setup(opts, siteSettings, state) {}export function cook(raw, opts) {- // we still have to hoist html_raw nodes so they bypass the whitelister+ // we still have to hoist html_raw nodes so they bypass the allowlister// this is the case for oneboxeslet hoisted = {};diff --git a/app/assets/javascripts/pretty-text/addon/oneboxer.js b/app/assets/javascripts/pretty-text/addon/oneboxer.jsindex e0720c3cadb..45733106c10 100644--- a/app/assets/javascripts/pretty-text/addon/oneboxer.js+++ b/app/assets/javascripts/pretty-text/addon/oneboxer.js@@ -30,7 +30,7 @@ function resolveSize(img) {// Detect square images and apply smaller onebox-avatar classfunction applySquareGenericOnebox($elem) {- if (!$elem.hasClass("whitelistedgeneric")) {+ if (!$elem.hasClass("allowlistedgeneric")) {return;}diff --git a/app/assets/javascripts/pretty-text/addon/white-lister.js b/app/assets/javascripts/pretty-text/addon/white-lister.jsindex 0d2ded7a4d2..0efb90643c6 100644--- a/app/assets/javascripts/pretty-text/addon/white-lister.js+++ b/app/assets/javascripts/pretty-text/addon/white-lister.js@@ -108,7 +108,7 @@ export default class WhiteLister {}}-// Only add to `default` when you always want your whitelist to occur. In other words,+// Only add to `default` when you always want your allowlist to occur. In other words,// don't change this for a plugin or a feature that can be disabledexport const DEFAULT_LIST = ["a.attachment",diff --git a/app/assets/javascripts/select-kit/addon/components/category-selector.js b/app/assets/javascripts/select-kit/addon/components/category-selector.jsindex 96ee7c0e782..3ba184a8579 100644--- a/app/assets/javascripts/select-kit/addon/components/category-selector.js+++ b/app/assets/javascripts/select-kit/addon/components/category-selector.js@@ -8,7 +8,7 @@ export default MultiSelectComponent.extend({pluginApiIdentifiers: ["category-selector"],classNames: ["category-selector"],categories: null,- blacklist: null,+ blockedCategories: null,selectKitOptions: {filterable: true,@@ -22,14 +22,15 @@ export default MultiSelectComponent.extend({this._super(...arguments);if (!this.categories) this.set("categories", []);- if (!this.blacklist) this.set("blacklist", []);+ if (!this.blockedCategories) this.set("blockedCategories", []);},- content: computed("categories.[]", "blacklist.[]", function() {- const blacklist = makeArray(this.blacklist);+ content: computed("categories.[]", "blockedCategories.[]", function() {+ const blockedCategories = makeArray(this.blockedCategories);return Category.list().filter(category => {return (- this.categories.includes(category) || !blacklist.includes(category)+ this.categories.includes(category) ||+ !blockedCategories.includes(category));});}),diff --git a/app/assets/javascripts/select-kit/addon/components/tag-chooser.js b/app/assets/javascripts/select-kit/addon/components/tag-chooser.jsindex 5cf4a833032..d5f28038c4c 100644--- a/app/assets/javascripts/select-kit/addon/components/tag-chooser.js+++ b/app/assets/javascripts/select-kit/addon/components/tag-chooser.js@@ -19,7 +19,7 @@ export default MultiSelectComponent.extend(TagsMixin, {return "tag-chooser-row";},- blacklist: null,+ blockedTags: null,attributeBindings: ["categoryId"],excludeSynonyms: false,excludeHasSynonyms: false,@@ -49,7 +49,7 @@ export default MultiSelectComponent.extend(TagsMixin, {this._super(...arguments);this.setProperties({- blacklist: this.blacklist || [],+ blockedTags: this.blockedTags || [],termMatchesForbidden: false,termMatchErrorMessage: null});@@ -84,9 +84,9 @@ export default MultiSelectComponent.extend(TagsMixin, {categoryId: this.categoryId};- if (selectedTags.length || this.blacklist.length) {+ if (selectedTags.length || this.blockedTags.length) {data.selected_tags = selectedTags- .concat(this.blacklist)+ .concat(this.blockedTags).uniq().slice(0, 100);}@@ -106,9 +106,9 @@ export default MultiSelectComponent.extend(TagsMixin, {termMatchErrorMessage: json.forbidden_message});- if (context.blacklist) {+ if (context.blockedTags) {results = results.filter(result => {- return !context.blacklist.includes(result.id);+ return !context.blockedTags.includes(result.id);});}diff --git a/app/assets/stylesheets/common/base/onebox.scss b/app/assets/stylesheets/common/base/onebox.scssindex 124da3ec4b6..de7b3845f5f 100644--- a/app/assets/stylesheets/common/base/onebox.scss+++ b/app/assets/stylesheets/common/base/onebox.scss@@ -625,7 +625,8 @@ aside.onebox.stackexchange .onebox-body {}}-// whitelistedgeneric twitter labels+// allowlistedgeneric twitter labels+.onebox.allowlistedgeneric,.onebox.whitelistedgeneric {.label1,.label2 {@@ -640,6 +641,7 @@ aside.onebox.stackexchange .onebox-body {}.onebox {+ &.allowlistedgeneric,&.whitelistedgeneric,&.gfycat {.site-icon {diff --git a/app/controllers/admin/embeddable_hosts_controller.rb b/app/controllers/admin/embeddable_hosts_controller.rbindex 5a59882f9b7..765408039ce 100644--- a/app/controllers/admin/embeddable_hosts_controller.rb+++ b/app/controllers/admin/embeddable_hosts_controller.rb@@ -22,7 +22,7 @@ class Admin::EmbeddableHostsController < Admin::AdminControllerdef save_host(host, action)host.host = params[:embeddable_host][:host]- host.path_whitelist = params[:embeddable_host][:path_whitelist]+ host.allowed_paths = params[:embeddable_host][:allowed_paths]host.class_name = params[:embeddable_host][:class_name]host.category_id = params[:embeddable_host][:category_id]host.category_id = SiteSetting.uncategorized_category_id if host.category_id.blank?diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rbindex a08bc95495b..a78a38f618b 100644--- a/app/controllers/admin/themes_controller.rb+++ b/app/controllers/admin/themes_controller.rb@@ -15,7 +15,7 @@ class Admin::ThemesController < Admin::AdminControllerdef upload_asset- ban_in_whitelist_mode!+ ban_in_allowlist_mode!path = params[:file].path@@ -53,7 +53,7 @@ class Admin::ThemesController < Admin::AdminController@theme = nilif params[:theme] && params[:theme].content_type == "application/json"- ban_in_whitelist_mode!+ ban_in_allowlist_mode!# .dcstyle.json import. Deprecated, but still available to allow conversionjson = JSON::parse(params[:theme].read)@@ -104,7 +104,7 @@ class Admin::ThemesController < Admin::AdminControllerendelsif params[:bundle] || (params[:theme] && THEME_CONTENT_TYPES.include?(params[:theme].content_type))- ban_in_whitelist_mode!+ ban_in_allowlist_mode!# params[:bundle] used by theme CLI. params[:theme] used by admin UIbundle = params[:bundle] || params[:theme]@@ -152,7 +152,7 @@ class Admin::ThemesController < Admin::AdminControllerdef create- ban_in_whitelist_mode!+ ban_in_allowlist_mode!@theme = Theme.new(name: theme_params[:name],user_id: theme_user.id,@@ -297,8 +297,8 @@ class Admin::ThemesController < Admin::AdminControllerprivate- def ban_in_whitelist_mode!- raise Discourse::InvalidAccess if !GlobalSetting.whitelisted_theme_ids.nil?+ def ban_in_allowlist_mode!+ raise Discourse::InvalidAccess if !GlobalSetting.allowed_theme_ids.nil?enddef add_relative_themes!(kind, ids)@@ -358,7 +358,7 @@ class Admin::ThemesController < Admin::AdminControllerdef set_fieldsreturn unless fields = theme_params[:theme_fields]- ban_in_whitelist_mode!+ ban_in_allowlist_mode!fields.each do |field|@theme.set_field(diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rbindex ade423ce7c4..74af0eafeab 100644--- a/app/controllers/posts_controller.rb+++ b/app/controllers/posts_controller.rb@@ -276,7 +276,7 @@ class PostsController < ApplicationControllerreply_history = post.reply_history(params[:max_replies].to_i, guardian)user_custom_fields = {}- if (added_fields = User.whitelisted_user_custom_fields(guardian)).present?+ if (added_fields = User.allowed_user_custom_fields(guardian)).present?user_custom_fields = User.custom_fields_for_ids(reply_history.pluck(:user_id), added_fields)end@@ -365,7 +365,7 @@ class PostsController < ApplicationControllerreplies = post.replies.secured(guardian)user_custom_fields = {}- if (added_fields = User.whitelisted_user_custom_fields(guardian)).present?+ if (added_fields = User.allowed_user_custom_fields(guardian)).present?user_custom_fields = User.custom_fields_for_ids(replies.pluck(:user_id), added_fields)end@@ -704,10 +704,10 @@ class PostsController < ApplicationControllerend- result = params.permit(*permitted).tap do |whitelisted|- whitelisted[:image_sizes] = params[:image_sizes]+ result = params.permit(*permitted).tap do |allowed|+ allowed[:image_sizes] = params[:image_sizes]# TODO this does not feel right, we should name what meta_data is allowed- whitelisted[:meta_data] = params[:meta_data]+ allowed[:meta_data] = params[:meta_data]end# Staff are allowed to pass `is_warning`diff --git a/app/controllers/robots_txt_controller.rb b/app/controllers/robots_txt_controller.rbindex 3af15d9174a..9fce3a7f674 100644--- a/app/controllers/robots_txt_controller.rb+++ b/app/controllers/robots_txt_controller.rb@@ -55,15 +55,15 @@ class RobotsTxtController < ApplicationControlleragents: []}- if SiteSetting.whitelisted_crawler_user_agents.present?- SiteSetting.whitelisted_crawler_user_agents.split('|').each do |agent|+ if SiteSetting.allowed_crawler_user_agents.present?+ SiteSetting.allowed_crawler_user_agents.split('|').each do |agent|result[:agents] << { name: agent, disallow: deny_paths }endresult[:agents] << { name: '*', disallow: deny_all }- elsif SiteSetting.blacklisted_crawler_user_agents.present?+ elsif SiteSetting.blocked_crawler_user_agents.present?result[:agents] << { name: '*', disallow: deny_paths }- SiteSetting.blacklisted_crawler_user_agents.split('|').each do |agent|+ SiteSetting.blocked_crawler_user_agents.split('|').each do |agent|result[:agents] << { name: agent, disallow: deny_all }endelsediff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex fccb772d984..a3b779ed6fa 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -117,7 +117,7 @@ class UsersController < ApplicationControllerusers = users.filter { |u| guardian.can_see_profile?(u) }- preload_fields = User.whitelisted_user_custom_fields(guardian) + UserField.all.pluck(:id).map { |fid| "#{User::USER_FIELD_PREFIX}#{fid}" }+ preload_fields = User.allowed_user_custom_fields(guardian) + UserField.all.pluck(:id).map { |fid| "#{User::USER_FIELD_PREFIX}#{fid}" }User.preload_custom_fields(users, preload_fields)User.preload_recent_time_read(users)diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rbindex d147a5afac9..5e3266d21e0 100644--- a/app/jobs/regular/pull_hotlinked_images.rb+++ b/app/jobs/regular/pull_hotlinked_images.rb@@ -205,7 +205,7 @@ module Jobshostname = uri.hostnamereturn false unless hostname- # check the domains blacklist+ # check the domains blocklistSiteSetting.should_download_images?(src)enddiff --git a/app/models/concerns/has_custom_fields.rb b/app/models/concerns/has_custom_fields.rbindex 64cafe6f7a5..0bb3fc55122 100644--- a/app/models/concerns/has_custom_fields.rb+++ b/app/models/concerns/has_custom_fields.rb@@ -72,15 +72,15 @@ module HasCustomFields# To avoid n+1 queries, use this function to retrieve lots of custom fields in one go# and create a "sideloaded" version for easy querying by id.- def self.custom_fields_for_ids(ids, whitelisted_fields)+ def self.custom_fields_for_ids(ids, allowed_fields)klass = "#{name}CustomField".constantizeforeign_key = "#{name.underscore}_id".to_symresult = {}- return result if whitelisted_fields.blank?+ return result if allowed_fields.blank?- klass.where(foreign_key => ids, :name => whitelisted_fields)+ klass.where(foreign_key => ids, :name => allowed_fields).pluck(foreign_key, :name, :value).each do |cf|result[cf[0]] ||= {}append_custom_field(result[cf[0]], cf[1], cf[2])diff --git a/app/models/embeddable_host.rb b/app/models/embeddable_host.rbindex 7984c0a18f9..8b393b4a254 100644--- a/app/models/embeddable_host.rb+++ b/app/models/embeddable_host.rb@@ -10,6 +10,9 @@ class EmbeddableHost < ActiveRecord::Baseself.host.sub!(/\/.*$/, '')end+ # TODO(2021-07-23): Remove+ self.ignored_columns = ["path_whitelist"]+def self.record_for_url(uri)if uri.is_a?(String)@@ -31,9 +34,9 @@ class EmbeddableHost < ActiveRecord::Basepath << "?" << uri.query if uri.query.present?where("lower(host) = ?", host).each do |eh|- return eh if eh.path_whitelist.blank?+ return eh if eh.allowed_paths.blank?- path_regexp = Regexp.new(eh.path_whitelist)+ path_regexp = Regexp.new(eh.allowed_paths)return eh if path_regexp.match(path) || path_regexp.match(UrlHelper.unencode(path))end@@ -78,6 +81,6 @@ end# category_id :integer not null# created_at :datetime not null# updated_at :datetime not null-# path_whitelist :string+# allowed_paths :string# class_name :string#diff --git a/app/models/embedding.rb b/app/models/embedding.rbindex 055cb2b32cb..909ba1c2727 100644--- a/app/models/embedding.rb+++ b/app/models/embedding.rb@@ -11,9 +11,9 @@ class Embedding < OpenStructembed_title_scrubberembed_truncateembed_unlisted- embed_whitelist_selector- embed_blacklist_selector- embed_classname_whitelist)+ allowed_embed_selectors+ blocked_embed_selectors+ allowed_embed_classnames)enddef base_urldiff --git a/app/models/global_setting.rb b/app/models/global_setting.rbindex 4a6149fda51..d6b076e319e 100644--- a/app/models/global_setting.rb+++ b/app/models/global_setting.rb@@ -204,15 +204,15 @@ class GlobalSettingend# test only- def self.reset_whitelisted_theme_ids!- @whitelisted_theme_ids = nil+ def self.reset_allowed_theme_ids!+ @allowed_theme_ids = nilend- def self.whitelisted_theme_ids- return nil if whitelisted_theme_repos.blank?+ def self.allowed_theme_ids+ return nil if allowed_theme_repos.blank?- @whitelisted_theme_ids ||= begin- urls = whitelisted_theme_repos.split(",").map(&:strip)+ @allowed_theme_ids ||= begin+ urls = allowed_theme_repos.split(",").map(&:strip)Theme.joins(:remote_theme).where('remote_themes.remote_url in (?)', urls)diff --git a/app/models/post.rb b/app/models/post.rbindex 766703268b0..c33649199e3 100644--- a/app/models/post.rb+++ b/app/models/post.rb@@ -254,8 +254,8 @@ class Post < ActiveRecord::BaseDigest::SHA1.hexdigest(raw)end- def self.white_listed_image_classes- @white_listed_image_classes ||= ['avatar', 'favicon', 'thumbnail', 'emoji', 'ytp-thumbnail-image']+ def self.allowed_image_classes+ @allowed_image_classes ||= ['avatar', 'favicon', 'thumbnail', 'emoji', 'ytp-thumbnail-image']enddef post_analyzer@@ -335,9 +335,9 @@ class Post < ActiveRecord::Baseself.last_editor_id ? (User.find_by_id(self.last_editor_id) || user) : userend- def whitelisted_spam_hosts+ def allowed_spam_hostshosts = SiteSetting- .white_listed_spam_host_domains+ .allowed_spam_host_domains.split('|').map { |h| h.strip }.reject { |h| !h.include?('.') }@@ -349,10 +349,10 @@ class Post < ActiveRecord::Basedef total_hosts_usagehosts = linked_hosts.clone- whitelisted = whitelisted_spam_hosts+ allowlisted = allowed_spam_hostshosts.reject! do |h|- whitelisted.any? do |w|+ allowlisted.any? do |w|h.end_with?(w)endenddiff --git a/app/models/post_analyzer.rb b/app/models/post_analyzer.rbindex c06d9d5f532..941c7f54491 100644--- a/app/models/post_analyzer.rb+++ b/app/models/post_analyzer.rb@@ -52,7 +52,7 @@ class PostAnalyzercooked_stripped.css("img").reject do |t|if dom_class = t["class"]- (Post.white_listed_image_classes & dom_class.split).count > 0+ (Post.allowed_image_classes & dom_class.split).count > 0endend.countenddiff --git a/app/models/screened_ip_address.rb b/app/models/screened_ip_address.rbindex 10ce1ce4f19..cc81c462f00 100644--- a/app/models/screened_ip_address.rb+++ b/app/models/screened_ip_address.rb@@ -75,7 +75,7 @@ class ScreenedIpAddress < ActiveRecord::Baseexists_for_ip_address_and_action?(ip_address, actions[:block])end- def self.is_whitelisted?(ip_address)+ def self.is_allowed?(ip_address)exists_for_ip_address_and_action?(ip_address, actions[:do_nothing])end@@ -87,7 +87,7 @@ class ScreenedIpAddress < ActiveRecord::Baseenddef self.block_admin_login?(user, ip_address)- return false unless SiteSetting.use_admin_ip_whitelist+ return false unless SiteSetting.use_admin_ip_allowlistreturn false if user.nil?return false if !user.admin?return false if ScreenedIpAddress.where(action_type: actions[:allow_admin]).count == 0diff --git a/app/models/site_setting.rb b/app/models/site_setting.rbindex bc966333598..a4f6f809778 100644--- a/app/models/site_setting.rb+++ b/app/models/site_setting.rb@@ -100,29 +100,29 @@ class SiteSetting < ActiveRecord::BaseWATCHED_SETTINGS ||= [:default_locale,- :attachment_content_type_blacklist,- :attachment_filename_blacklist,- :unicode_username_character_whitelist,+ :blocked_attachment_content_types,+ :blocked_attachment_filenames,+ :allowed_unicode_username_characters,:markdown_typographer_quotation_marks]def self.reset_cached_settings!- @attachment_content_type_blacklist_regex = nil- @attachment_filename_blacklist_regex = nil- @unicode_username_whitelist_regex = nil+ @blocked_attachment_content_types_regex = nil+ @blocked_attachment_filenames_regex = nil+ @allowed_unicode_username_regex = nilend- def self.attachment_content_type_blacklist_regex- @attachment_content_type_blacklist_regex ||= Regexp.union(SiteSetting.attachment_content_type_blacklist.split("|"))+ def self.blocked_attachment_content_types_regex+ @blocked_attachment_content_types_regex ||= Regexp.union(SiteSetting.blocked_attachment_content_types.split("|"))end- def self.attachment_filename_blacklist_regex- @attachment_filename_blacklist_regex ||= Regexp.union(SiteSetting.attachment_filename_blacklist.split("|"))+ def self.blocked_attachment_filenames_regex+ @blocked_attachment_filenames_regex ||= Regexp.union(SiteSetting.blocked_attachment_filenames.split("|"))end- def self.unicode_username_character_whitelist_regex- @unicode_username_whitelist_regex ||= SiteSetting.unicode_username_character_whitelist.present? \- ? Regexp.new(SiteSetting.unicode_username_character_whitelist) : nil+ def self.allowed_unicode_username_characters_regex+ @allowed_unicode_username_regex ||= SiteSetting.allowed_unicode_username_characters.present? \+ ? Regexp.new(SiteSetting.allowed_unicode_username_characters) : nilend# helpers for getting s3 settings that fallback to global@@ -213,6 +213,38 @@ class SiteSetting < ActiveRecord::Basec.present? && c.to_i != SiteSetting.uncategorized_category_id.to_iend+ ALLOWLIST_DEPRECATED_SITE_SETTINGS = {+ 'email_domains_blacklist': 'blocked_email_domains',+ 'email_domains_whitelist': 'allowed_email_domains',+ 'unicode_username_character_whitelist': 'allowed_unicode_username_characters',+ 'user_website_domains_whitelist': 'allowed_user_website_domains',+ 'whitelisted_link_domains': 'allowed_link_domains',+ 'embed_whitelist_selector': 'allowed_embed_selectors',+ 'auto_generated_whitelist': 'auto_generated_allowlist',+ 'attachment_content_type_blacklist': 'blocked_attachment_content_types',+ 'attachment_filename_blacklist': 'blocked_attachment_filenames',+ 'use_admin_ip_whitelist': 'use_admin_ip_allowlist',+ 'blacklist_ip_blocks': 'blocked_ip_blocks',+ 'whitelist_internal_hosts': 'allowed_internal_hosts',+ 'whitelisted_crawler_user_agents': 'allowed_crawler_user_agents',+ 'blacklisted_crawler_user_agents': 'blocked_crawler_user_agents',+ 'onebox_domains_blacklist': 'blocked_onebox_domains',+ 'inline_onebox_domains_whitelist': 'allowed_inline_onebox_domains',+ 'white_listed_spam_host_domains': 'allowed_spam_host_domains',+ 'embed_blacklist_selector': 'blocked_embed_selectors',+ 'embed_classname_whitelist': 'allowed_embed_classnames',+ }++ ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair do |old_method, new_method|+ self.class.define_method(old_method) do+ Discourse.deprecate("#{old_method.to_s} is deprecated, use the #{new_method.to_s}.", drop_from: "2.6")+ send(new_method)+ end+ self.class.define_method("#{old_method}=") do |args|+ Discourse.deprecate("#{old_method.to_s} is deprecated, use the #{new_method.to_s}.", drop_from: "2.6")+ send("#{new_method}=", args)+ end+ endend# == Schema Informationdiff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rbindex 7529e98353e..26e0a051a8d 100644--- a/app/models/topic_embed.rb+++ b/app/models/topic_embed.rb@@ -124,9 +124,9 @@ class TopicEmbed < ActiveRecord::Baseremove_empty_nodes: false}- opts[:whitelist] = SiteSetting.embed_whitelist_selector if SiteSetting.embed_whitelist_selector.present?- opts[:blacklist] = SiteSetting.embed_blacklist_selector if SiteSetting.embed_blacklist_selector.present?- embed_classname_whitelist = SiteSetting.embed_classname_whitelist if SiteSetting.embed_classname_whitelist.present?+ opts[:allowlist] = SiteSetting.allowed_embed_selectors if SiteSetting.allowed_embed_selectors.present?+ opts[:blocklist] = SiteSetting.blocked_embed_selectors if SiteSetting.blocked_embed_selectors.present?+ allowed_embed_classnames = SiteSetting.allowed_embed_classnames if SiteSetting.allowed_embed_classnames.present?response = FetchResponse.newbegin@@ -169,8 +169,8 @@ class TopicEmbed < ActiveRecord::Base# If there is a mistyped URL, just do nothingendend- # only allow classes in the whitelist- allowed_classes = if embed_classname_whitelist.blank? then [] else embed_classname_whitelist.split(/[ ,]+/i) end+ # only allow classes in the allowlist+ allowed_classes = if allowed_embed_classnames.blank? then [] else allowed_embed_classnames.split(/[ ,]+/i) enddoc.search('[class]:not([class=""])').each do |classnode|classes = classnode[:class].split(' ').select { |classname| allowed_classes.include?(classname) }if classes.length === 0diff --git a/app/models/topic_link_click.rb b/app/models/topic_link_click.rbindex a4b59b9dd48..91d22a1ee05 100644--- a/app/models/topic_link_click.rb+++ b/app/models/topic_link_click.rb@@ -92,7 +92,7 @@ class TopicLinkClick < ActiveRecord::Basereturn nil unless uri- # Only redirect to whitelisted hostnames+ # Only redirect to allowlisted hostnamesreturn url if WHITELISTED_REDIRECT_HOSTNAMES.include?(uri.hostname) || is_cdn_linkreturn nildiff --git a/app/models/translation_override.rb b/app/models/translation_override.rbindex e883a0f1bdf..a09797f33cf 100644--- a/app/models/translation_override.rb+++ b/app/models/translation_override.rb@@ -3,7 +3,7 @@require "i18n/i18n_interpolation_keys_finder"class TranslationOverride < ActiveRecord::Base- # Whitelist i18n interpolation keys that can be included when customizing translations+ # Allowlist i18n interpolation keys that can be included when customizing translationsCUSTOM_INTERPOLATION_KEYS_WHITELIST = {"user_notifications.user_" => %w{topic_title_url_encodeddiff --git a/app/models/user.rb b/app/models/user.rbindex acbcdb0c18c..370ad172ba4 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -294,7 +294,7 @@ class User < ActiveRecord::BaseDiscoursePluginRegistry.register_public_user_custom_field(custom_field_name, plugin)end- def self.whitelisted_user_custom_fields(guardian)+ def self.allowed_user_custom_fields(guardian)fields = []fields.push *DiscoursePluginRegistry.public_user_custom_fieldsdiff --git a/app/models/user_profile.rb b/app/models/user_profile.rbindex bb276d30ca9..937ff061ba3 100644--- a/app/models/user_profile.rb+++ b/app/models/user_profile.rb@@ -131,7 +131,7 @@ class UserProfile < ActiveRecord::Baseenddef website_domain_validator- allowed_domains = SiteSetting.user_website_domains_whitelist+ allowed_domains = SiteSetting.allowed_user_website_domainsreturn if (allowed_domains.blank? || self.website.blank?)domain = begindiff --git a/app/models/username_validator.rb b/app/models/username_validator.rbindex 8a588ad56c4..1bb51491e67 100644--- a/app/models/username_validator.rb+++ b/app/models/username_validator.rb@@ -32,7 +32,7 @@ class UsernameValidatorusername_length_min?username_length_max?username_char_valid?- username_char_whitelisted?+ username_char_allowed?username_first_char_valid?username_last_char_valid?username_no_double_special?@@ -85,10 +85,10 @@ class UsernameValidatorendend- def username_char_whitelisted?- return unless errors.empty? && self.class.char_whitelist_exists?+ def username_char_allowed?+ return unless errors.empty? && self.class.char_allowlist_exists?- if username.chars.any? { |c| !self.class.whitelisted_char?(c) }+ if username.chars.any? { |c| !self.class.allowed_char?(c) }self.errors << I18n.t(:'user.username.characters')endend@@ -133,11 +133,11 @@ class UsernameValidatorSiteSetting.unicode_usernames ? UNICODE_INVALID_CHAR_PATTERN : ASCII_INVALID_CHAR_PATTERNend- def self.char_whitelist_exists?- SiteSetting.unicode_usernames && SiteSetting.unicode_username_character_whitelist_regex.present?+ def self.char_allowlist_exists?+ SiteSetting.unicode_usernames && SiteSetting.allowed_unicode_username_characters.present?end- def self.whitelisted_char?(c)- c.match?(/[\w.-]/) || c.match?(SiteSetting.unicode_username_character_whitelist_regex)+ def self.allowed_char?(c)+ c.match?(/[\w.-]/) || c.match?(SiteSetting.allowed_unicode_username_characters)endenddiff --git a/app/serializers/embeddable_host_serializer.rb b/app/serializers/embeddable_host_serializer.rbindex c06b7151425..28bf3e905bc 100644--- a/app/serializers/embeddable_host_serializer.rb+++ b/app/serializers/embeddable_host_serializer.rb@@ -2,7 +2,7 @@class EmbeddableHostSerializer < ApplicationSerializer- TO_SERIALIZE = [:id, :host, :path_whitelist, :class_name, :category_id]+ TO_SERIALIZE = [:id, :host, :allowed_paths, :class_name, :category_id]attributes *TO_SERIALIZEdiff --git a/app/serializers/flagged_user_serializer.rb b/app/serializers/flagged_user_serializer.rbindex 51fc0b83283..92a383559aa 100644--- a/app/serializers/flagged_user_serializer.rb+++ b/app/serializers/flagged_user_serializer.rb@@ -36,7 +36,7 @@ class FlaggedUserSerializer < BasicUserSerializerenddef custom_fields- fields = User.whitelisted_user_custom_fields(scope)+ fields = User.allowed_user_custom_fields(scope)result = {}fields.each do |k|diff --git a/app/serializers/user_card_serializer.rb b/app/serializers/user_card_serializer.rbindex ebc8ee2db68..6136d5c737d 100644--- a/app/serializers/user_card_serializer.rb+++ b/app/serializers/user_card_serializer.rb@@ -216,6 +216,6 @@ class UserCardSerializer < BasicUserSerializerdef custom_field_keys# Can be extended by other serializers- User.whitelisted_user_custom_fields(scope)+ User.allowed_user_custom_fields(scope)endenddiff --git a/app/serializers/user_with_custom_fields_serializer.rb b/app/serializers/user_with_custom_fields_serializer.rbindex 6492d2f695d..10cb152990b 100644--- a/app/serializers/user_with_custom_fields_serializer.rb+++ b/app/serializers/user_with_custom_fields_serializer.rb@@ -22,6 +22,6 @@ class UserWithCustomFieldsSerializer < BasicUserSerializerdef custom_field_keys# Can be extended by other serializers- User.whitelisted_user_custom_fields(scope)+ User.allowed_user_custom_fields(scope)endenddiff --git a/app/services/spam_rule/flag_sockpuppets.rb b/app/services/spam_rule/flag_sockpuppets.rbindex 1bc930b48c8..00f74e881be 100644--- a/app/services/spam_rule/flag_sockpuppets.rb+++ b/app/services/spam_rule/flag_sockpuppets.rb@@ -28,7 +28,7 @@ class SpamRule::FlagSockpuppets@post.user != first_post.user &&@post.user.ip_address == first_post.user.ip_address &&@post.user.new_user? &&- !ScreenedIpAddress.is_whitelisted?(@post.user.ip_address)+ !ScreenedIpAddress.is_allowed?(@post.user.ip_address)enddef flag_sockpuppet_usersdiff --git a/app/services/user_destroyer.rb b/app/services/user_destroyer.rbindex e0f7543ac66..51ece7789ba 100644--- a/app/services/user_destroyer.rb+++ b/app/services/user_destroyer.rb@@ -44,7 +44,7 @@ class UserDestroyerif opts[:block_urls]post.topic_links.each do |link|next if link.internal- next if Oneboxer.engine(link.url) != Onebox::Engine::WhitelistedGenericOnebox+ next if Oneboxer.engine(link.url) != Onebox::Engine::AllowlistedGenericOneboxScreenedUrl.watch(link.url, link.domain, ip_address: user.ip_address)&.record_match!endenddiff --git a/app/views/embed/embed_error.html.erb b/app/views/embed/embed_error.html.erbindex 37403f69b1c..48c28e12257 100644--- a/app/views/embed/embed_error.html.erb+++ b/app/views/embed/embed_error.html.erb@@ -12,7 +12,7 @@<ul><%- @hosts.each do |eh| %><li>- <%= eh.host %><%- if eh.path_whitelist.present? %><%= eh.path_whitelist %><% end %>+ <%= eh.host %><%- if eh.allowed_paths.present? %><%= eh.allowed_paths %><% end %></li><%- end %></ul>diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.confindex b71cffa3071..8dadac203e4 100644--- a/config/discourse_defaults.conf+++ b/config/discourse_defaults.conf@@ -291,11 +291,11 @@ anon_cache_store_threshold = 2# EXPERIMENTAL - not yet supported in production# by default admins can install and amend any theme# you may restrict it so only specific themes are approved-# in whitelist mode all theme updates must happen via git repos+# in allowlist mode all theme updates must happen via git repos# themes missing from the list are automatically disallowed# list is a comma seperated list of git repos eg:# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git-whitelisted_theme_repos =+allowed_theme_repos =# Demon::EmailSync is used in conjunction with the enable_imap site setting# to sync N IMAP mailboxes with specific groups. It is a process started indiff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 1e3ddae9de9..49e1281e52c 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -4255,7 +4255,7 @@ en:domain: "Domain"screened_ips:title: "Screened IPs"- description: 'IP addresses that are being watched. Use "Allow" to whitelist IP addresses.'+ description: 'IP addresses that are being watched. Use "Allow" to allowlist IP addresses.'delete_confirm: "Are you sure you want to remove the rule for %{ip_address}?"roll_up_confirm: "Are you sure you want to roll up commonly screened IP addresses into subnets?"rolled_up_some_subnets: "Successfully rolled up IP ban entries to these subnets: %{subnets}."@@ -4777,7 +4777,7 @@ en:title: "Embedding"host: "Allowed Hosts"class_name: "Class Name"- path_whitelist: "Path Whitelist"+ allowed_paths: "Path Allowlist"edit: "edit"category: "Post to Category"add_host: "Add Host"@@ -4790,9 +4790,9 @@ en:embed_title_scrubber: "Regular expression used to scrub the title of posts"embed_truncate: "Truncate the embedded posts"embed_unlisted: "Imported topics will be unlisted until there is a reply."- embed_whitelist_selector: "CSS selector for elements that are allowed in embeds"- embed_blacklist_selector: "CSS selector for elements that are removed from embeds"- embed_classname_whitelist: "Allowed CSS class names"+ allowed_embed_selectors: "CSS selector for elements that are allowed in embeds"+ blocked_embed_selectors: "CSS selector for elements that are removed from embeds"+ allowed_embed_classnames: "Allowed CSS class names"save: "Save Embedding Settings"permalink:diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 8c3c14f0b6a..d70b41b6519 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -139,7 +139,7 @@ en:bounced_email_error: "Email is a bounced email report."screened_email_error: "Happens when the sender's email address was already screened."unsubscribe_not_allowed: "Happens when unsubscribing via email is not allowed for this user."- email_not_allowed: "Happens when the email address is not on the whitelist or is on the blacklist."+ email_not_allowed: "Happens when the email address is not on the allowlist or is on the blocklist."unrecognized_error: "Unrecognized Error"secure_media_placeholder: "Redacted: this site has secure media enabled, visit the topic to see the attached image/audio/video."@@ -1485,9 +1485,9 @@ en:show_pinned_excerpt_mobile: "Show excerpt on pinned topics in mobile view."show_pinned_excerpt_desktop: "Show excerpt on pinned topics in desktop view."post_onebox_maxlength: "Maximum length of a oneboxed Discourse post in characters."- onebox_domains_blacklist: "A list of domains that will never be oneboxed."- inline_onebox_domains_whitelist: "A list of domains that will be oneboxed in miniature form if linked without a title"- enable_inline_onebox_on_all_domains: "Ignore inline_onebox_domain_whitelist site setting and allow inline onebox on all domains."+ blocked_onebox_domains: "A list of domains that will never be oneboxed."+ allowed_inline_onebox_domains: "A list of domains that will be oneboxed in miniature form if linked without a title"+ enable_inline_onebox_on_all_domains: "Ignore inline_onebox_domain_allowlist site setting and allow inline onebox on all domains."force_custom_user_agent_hosts: "Hosts for which to use the custom onebox user agent on all requests. (Especially useful for hosts that limit access by user agent)."max_oneboxes_per_post: "Maximum number of oneboxes in a post."@@ -1556,22 +1556,22 @@ en:ga_universal_tracking_code: "Google Universal Analytics (analytics.js) tracking code ID, eg: UA-12345678-9; see <a href='https://google.com/analytics' target='_blank'>https://google.com/analytics</a>"ga_universal_domain_name: "Google Universal Analytics (analytics.js) domain name, eg: mysite.com; see <a href='https://google.com/analytics' target='_blank'>https://google.com/analytics</a>"ga_universal_auto_link_domains: "Enable Google Universal Analytics (analytics.js) cross-domain tracking. Outgoing links to these domains will have the client id added to them. See <a href='https://support.google.com/analytics/answer/1034342?hl=en' target='_blank'>Google's Cross-Domain Tracking guide.</a>"- gtm_container_id: "Google Tag Manager container id. eg: GTM-ABCDEF. <br/>Note: Third-party scripts loaded by GTM may need to be whitelisted in 'content security policy script src'."+ gtm_container_id: "Google Tag Manager container id. eg: GTM-ABCDEF. <br/>Note: Third-party scripts loaded by GTM may need to be allowlisted in 'content security policy script src'."enable_escaped_fragments: "Fall back to Google's Ajax-Crawling API if no webcrawler is detected. See <a href='https://developers.google.com/webmasters/ajax-crawling/docs/learn-more' target='_blank'>https://developers.google.com/webmasters/ajax-crawling/docs/learn-more</a>"moderators_create_categories: "Allow moderators to create new categories"cors_origins: "Allowed origins for cross-origin requests (CORS). Each origin must include http:// or https://. The DISCOURSE_ENABLE_CORS env variable must be set to true to enable CORS."- use_admin_ip_whitelist: "Admins can only log in if they are at an IP address defined in the Screened IPs list (Admin > Logs > Screened Ips)."- blacklist_ip_blocks: "A list of private IP blocks that should never be crawled by Discourse"- whitelist_internal_hosts: "A list of internal hosts that discourse can safely crawl for oneboxing and other purposes"+ use_admin_ip_allowlist: "Admins can only log in if they are at an IP address defined in the Screened IPs list (Admin > Logs > Screened Ips)."+ blocked_ip_blocks: "A list of private IP blocks that should never be crawled by Discourse"+ allowed_internal_hosts: "A list of internal hosts that discourse can safely crawl for oneboxing and other purposes"allowed_iframes: "A list of iframe src domain prefixes that discourse can safely allow in posts"- whitelisted_crawler_user_agents: "User agents of web crawlers that should be allowed to access the site. WARNING! SETTING THIS WILL DISALLOW ALL CRAWLERS NOT LISTED HERE!"- blacklisted_crawler_user_agents: "Unique case insensitive word in the user agent string identifying web crawlers that should not be allowed to access the site. Does not apply if whitelist is defined."+ allowed_crawler_user_agents: "User agents of web crawlers that should be allowed to access the site. WARNING! SETTING THIS WILL DISALLOW ALL CRAWLERS NOT LISTED HERE!"+ blocked_crawler_user_agents: "Unique case insensitive word in the user agent string identifying web crawlers that should not be allowed to access the site. Does not apply if allowlist is defined."slow_down_crawler_user_agents: "User agents of web crawlers that should be rate limited in robots.txt using the Crawl-delay directive"slow_down_crawler_rate: "If slow_down_crawler_user_agents is specified this rate will apply to all the crawlers (number of seconds delay between requests)"content_security_policy: "Enable Content-Security-Policy"content_security_policy_report_only: "Enable Content-Security-Policy-Report-Only"content_security_policy_collect_reports: "Enable CSP violation report collection at /csp_reports"- content_security_policy_script_src: "Additional whitelisted script sources. The current host and CDN are included by default. See <a href='https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243' target='_blank'>Mitigate XSS Attacks with Content Security Policy.</a>"+ content_security_policy_script_src: "Additional allowlisted script sources. The current host and CDN are included by default. See <a href='https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243' target='_blank'>Mitigate XSS Attacks with Content Security Policy.</a>"invalidate_inactive_admin_email_after_days: "Admin accounts that have not visited the site in this number of days will need to re-validate their email address before logging in. Set to 0 to disable."top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|new|unread|categories|top|read|posted|bookmarks"post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply"@@ -1601,8 +1601,8 @@ en:enable_whispers: "Allow staff private communication within topics."allow_index_in_robots_txt: "Specify in robots.txt that this site is allowed to be indexed by web search engines. In exceptional cases you can permanently <a href='%{base_path}/admin/customize/robots'>override robots.txt</a>."- email_domains_blacklist: "A pipe-delimited list of email domains that users are not allowed to register accounts with. Example: mailinator.com|trashmail.net"- email_domains_whitelist: "A pipe-delimited list of email domains that users MUST register accounts with. WARNING: Users with email domains other than those listed will not be allowed!"+ blocked_email_domains: "A pipe-delimited list of email domains that users are not allowed to register accounts with. Example: mailinator.com|trashmail.net"+ allowed_email_domains: "A pipe-delimited list of email domains that users MUST register accounts with. WARNING: Users with email domains other than those listed will not be allowed!"auto_approve_email_domains: "Users with email addresses from this list of domains will be automatically approved."hide_email_address_taken: "Don't inform users that an account exists with a given email address during signup and from the forgot password form."log_out_strict: "When logging out, log out ALL sessions for the user on all devices"@@ -1618,7 +1618,7 @@ en:min_username_length: "Minimum username length in characters. WARNING: if any existing users or groups have names shorter than this, your site will break!"max_username_length: "Maximum username length in characters. WARNING: if any existing users or groups have names longer than this, your site will break!"unicode_usernames: "Allow usernames and group names to contain Unicode letters and numbers."- unicode_username_character_whitelist: "Regular expression to allow only some Unicode characters within usernames. ASCII letters and numbers will always be allowed and don't need to be included in the whitelist."+ allowed_unicode_username_characters: "Regular expression to allow only some Unicode characters within usernames. ASCII letters and numbers will always be allowed and don't need to be included in the allowlist."reserved_usernames: "Usernames for which signup is not allowed. Wildcard symbol * can be used to match any character zero or more times."@@ -1819,7 +1819,7 @@ en:min_trust_to_post_links: "The minimum trust level required to include links in posts"min_trust_to_post_images: "The minimum trust level required to include images in a post"- whitelisted_link_domains: "Domains that users may link to even if they don't have the appropriate trust level to post links"+ allowed_link_domains: "Domains that users may link to even if they don't have the appropriate trust level to post links"newuser_max_links: "How many links a new user can add to a post."newuser_max_images: "How many images a new user can add to a post."@@ -1887,7 +1887,7 @@ en:newuser_spam_host_threshold: "How many times a new user can post a link to the same host within their `newuser_spam_host_threshold` posts before being considered spam."- white_listed_spam_host_domains: "A list of domains excluded from spam host testing. New users will never be restricted from creating posts with links to these domains."+ allowed_spam_host_domains: "A list of domains excluded from spam host testing. New users will never be restricted from creating posts with links to these domains."staff_like_weight: "How much extra weighting factor to give staff likes."topic_view_duration_hours: "Count a new topic view once per IP/User every N hours"user_profile_view_duration_hours: "Count a new user profile view once per IP/User every N hours"@@ -1933,7 +1933,7 @@ en:max_emails_per_day_per_user: "Maximum number of emails to send users per day. 0 to disable the limit"enable_staged_users: "Automatically create staged users when processing incoming emails."maximum_staged_users_per_email: "Maximum number of staged users created when processing an incoming email."- auto_generated_whitelist: "List of email addresses that won't be checked for auto-generated content. Example: [email protected]|[email protected]"+ auto_generated_allowlist: "List of email addresses that won't be checked for auto-generated content. Example: [email protected]|[email protected]"block_auto_generated_emails: "Block incoming emails identified as being auto generated."ignore_by_title: "Ignore incoming emails based on their title."mailgun_api_key: "Mailgun Secret API key used to verify webhook messages."@@ -1943,8 +1943,8 @@ en:bounce_score_threshold: "Max bounce score before we will stop emailing a user."reset_bounce_score_after_days: "Automatically reset bounce score after X days."- attachment_content_type_blacklist: "List of keywords used to blacklist attachments based on the content type."- attachment_filename_blacklist: "List of keywords used to blacklist attachments based on the filename."+ blocked_attachment_content_types: "List of keywords used to blocklist attachments based on the content type."+ blocked_attachment_filenames: "List of keywords used to blocklist attachments based on the filename."forwarded_emails_behaviour: "How to treat a forwarded email to Discourse"always_show_trimmed_content: "Always show trimmed part of incoming emails. WARNING: might reveal email addresses."@@ -2046,7 +2046,7 @@ en:max_notifications_per_user: "Maximum amount of notifications per user, if this number is exceeded old notifications will be deleted. Enforced weekly. Set to 0 to disable"- user_website_domains_whitelist: "User website will be verified against these domains. Pipe-delimited list."+ allowed_user_website_domains: "User website will be verified against these domains. Pipe-delimited list."allow_profile_backgrounds: "Allow users to upload profile backgrounds."@@ -2110,7 +2110,7 @@ en:embed_truncate: "Truncate the embedded posts."embed_unlisted: "Imported topics will be unlisted until a user replies."embed_support_markdown: "Support Markdown formatting for embedded posts."- embed_whitelist_selector: "A comma separated list of CSS elements that are allowed in embeds."+ allowed_embed_selectors: "A comma separated list of CSS elements that are allowed in embeds."allowed_href_schemes: "Schemes allowed in links in addition to http and https."embed_post_limit: "Maximum number of posts to embed."embed_username_required: "The username for topic creation is required."@@ -2280,7 +2280,7 @@ en:low_weight_invalid: "You cannot set the weight to be greater or equal to 1 or smaller than 'category_search_priority_very_low_weight'."high_weight_invalid: "You cannot set the weight to be smaller or equal to 1 or greater than 'category_search_priority_very_high_weight'."very_high_weight_invalid: "You cannot set the weight to be smaller than 'category_search_priority_high_weight'."- unicode_username_whitelist:+ allowed_unicode_usernames:regex_invalid: "The regular expression is invalid: %{error}"leading_trailing_slash: "The regular expression must not start and end with a slash."unicode_usernames_avatars: "The internal system avatars do not support Unicode usernames."@@ -2642,7 +2642,7 @@ en:- Is your domain's [DKIM record][3] correct? This will significantly improve email deliverability. [Test your DKIM record][7] here.- - If you run your own mail server, check to make sure the IPs of your mail server are [not on any email blacklists][4]. Also verify that it is definitely sending a fully-qualified hostname that resolves in DNS in its HELO message. If not, this will cause your email to be rejected by many mail services.+ - If you run your own mail server, check to make sure the IPs of your mail server are [not on any email blocklists][4]. Also verify that it is definitely sending a fully-qualified hostname that resolves in DNS in its HELO message. If not, this will cause your email to be rejected by many mail services.- We highly recommend you **send a test email to [mail-tester.com][mt]** to verify that all the above is working correctly.@@ -3236,7 +3236,7 @@ en:Please [review the user](%{user_url}).- This can be modified via the `newuser_spam_host_threshold` and `white_listed_spam_host_domains` site settings. Consider adding %{domains} to the whitelist if they should be exempt.+ This can be modified via the `newuser_spam_host_threshold` and `allowed_spam_host_domains` site settings. Consider adding %{domains} to the allowlist if they should be exempt.unsilenced:title: "Unsilenced"diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 98c2ea0b533..20f1e1a81a4 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -443,10 +443,10 @@ login:sso_overrides_website: falsesso_overrides_card_background: falsesso_not_approved_url: ""- email_domains_blacklist:+ blocked_email_domains:default: "mailinator.com"type: list- email_domains_whitelist:+ allowed_email_domains:default: ""type: listauto_approve_email_domains:@@ -478,8 +478,8 @@ users:default: falseclient: truevalidator: "UnicodeUsernameValidator"- unicode_username_character_whitelist:- validator: "UnicodeUsernameWhitelistValidator"+ allowed_unicode_username_characters:+ validator: "UnicodeUsernameAllowlistValidator"default: ""locale_default:cs: "[ěščřžýáíéóůúďťňĚŠČŘŽÝÁÍÉÓŮÚĎŤŇ]"@@ -573,7 +573,7 @@ users:client: trueshow_inactive_accounts:default: false- user_website_domains_whitelist:+ allowed_user_website_domains:default: ""type: listhide_suspension_reasons:@@ -798,7 +798,7 @@ posting:ko: 50zh_CN: 50zh_TW: 50- whitelisted_link_domains:+ allowed_link_domains:default: ""type: listnewuser_max_links: 2@@ -908,7 +908,7 @@ posting:embed_unlisted: falseembed_truncate: trueembed_support_markdown: false- embed_whitelist_selector: ""+ allowed_embed_selectors: ""allowed_href_schemes:client: truedefault: ""@@ -1082,7 +1082,7 @@ email:max_emails_per_day_per_user: 100enable_staged_users: truemaximum_staged_users_per_email: 10- auto_generated_whitelist:+ auto_generated_allowlist:default: ""type: listblock_auto_generated_emails: true@@ -1109,11 +1109,11 @@ email:reset_bounce_score_after_days:default: 30max: 36500- attachment_content_type_blacklist:+ blocked_attachment_content_types:type: listdefault: "pkcs7|x-vcard"list_type: compact- attachment_filename_blacklist:+ blocked_attachment_filenames:type: listdefault: "smime.p7s|signature.asc|winmail.dat"list_type: compact@@ -1456,25 +1456,25 @@ security:cors_origins:default: ""type: list- use_admin_ip_whitelist:+ use_admin_ip_allowlist:default: falseclient: true- blacklist_ip_blocks:+ blocked_ip_blocks:default: ""type: listlist_type: compact- whitelist_internal_hosts:+ allowed_internal_hosts:default: ""type: listallowed_iframes:default: "https://www.google.com/maps/embed?|https://www.openstreetmap.org/export/embed.html?|https://calendar.google.com/calendar/embed?|https://codepen.io/"type: listclient: true- whitelisted_crawler_user_agents:+ allowed_crawler_user_agents:type: listdefault: ""list_type: compact- blacklisted_crawler_user_agents:+ blocked_crawler_user_agents:type: listdefault: "mauibot|semrushbot|ahrefsbot|blexbot|seo spider"list_type: compact@@ -1511,14 +1511,14 @@ onebox:ja: 200zh_CN: 200zh_TW: 200- onebox_domains_blacklist:+ blocked_onebox_domains:default: ""type: listlist_type: compactmax_oneboxes_per_post:default: 50client: true- inline_onebox_domains_whitelist:+ allowed_inline_onebox_domains:default: ""type: listlist_type: compact@@ -1542,7 +1542,7 @@ spam:notify_mods_when_user_silenced: falseflag_sockpuppets: falsenewuser_spam_host_threshold: 3- white_listed_spam_host_domains:+ allowed_spam_host_domains:default: ""type: listlevenshtein_distance_spammer_emails:@@ -1728,10 +1728,10 @@ embedding:embed_title_scrubber:default: ""hidden: true- embed_blacklist_selector:+ blocked_embed_selectors:default: ""hidden: true- embed_classname_whitelist:+ allowed_embed_classnames:default: "emoji"hidden: truediff --git a/db/migrate/20200709032247_allowlist_and_blocklist_site_settings.rb b/db/migrate/20200709032247_allowlist_and_blocklist_site_settings.rbnew file mode 100644index 00000000000..7145c9fe818--- /dev/null+++ b/db/migrate/20200709032247_allowlist_and_blocklist_site_settings.rb@@ -0,0 +1,23 @@+# frozen_string_literal: true++class AllowlistAndBlocklistSiteSettings < ActiveRecord::Migration[6.0]+ def up+ SiteSetting::ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair do |old_key, new_key|+ DB.exec <<~SQL+ INSERT INTO site_settings(name, data_type, value, created_at, updated_at)+ SELECT '#{new_key}', data_type, value, created_at, updated_At+ FROM site_settings+ WHERE name = '#{old_key}'+ SQL+ end+ end++ def down+ SiteSetting::ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair do |_old_key, new_key|+ DB.exec <<~SQL+ DELETE FROM site_settings+ WHERE name = '#{new_key}'+ SQL+ end+ end+enddiff --git a/db/post_migrate/20200629232159_rename_path_whitelist_to_allowed_paths.rb b/db/post_migrate/20200629232159_rename_path_whitelist_to_allowed_paths.rbnew file mode 100644index 00000000000..3e55cabe2db--- /dev/null+++ b/db/post_migrate/20200629232159_rename_path_whitelist_to_allowed_paths.rb@@ -0,0 +1,7 @@+# frozen_string_literal: true++class RenamePathWhitelistToAllowedPaths < ActiveRecord::Migration[6.0]+ def change+ rename_column :embeddable_hosts, :path_whitelist, :allowed_paths+ end+enddiff --git a/db/post_migrate/20200724060632_remove_deprecated_allowlist_settings.rb b/db/post_migrate/20200724060632_remove_deprecated_allowlist_settings.rbnew file mode 100644index 00000000000..38b87c9ac26--- /dev/null+++ b/db/post_migrate/20200724060632_remove_deprecated_allowlist_settings.rb@@ -0,0 +1,23 @@+# frozen_string_literal: true++class RemoveDeprecatedAllowlistSettings < ActiveRecord::Migration[6.0]+ def up+ SiteSetting::ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair do |old_key, _new_key|+ DB.exec <<~SQL+ DELETE FROM site_settings+ WHERE name = '#{old_key}'+ SQL+ end+ end++ def down+ SiteSetting::ALLOWLIST_DEPRECATED_SITE_SETTINGS.each_pair do |old_key, new_key|+ DB.exec <<~SQL+ INSERT INTO site_settings(name, data_type, value, created_at, updated_at)+ SELECT '#{old_key}', data_type, value, created_at, updated_At+ FROM site_settings+ WHERE name = '#{new_key}'+ SQL+ end+ end+enddiff --git a/docs/SECURITY.md b/docs/SECURITY.mdindex 7e1606d2b0c..ee485b5f055 100644--- a/docs/SECURITY.md+++ b/docs/SECURITY.md@@ -29,7 +29,7 @@ There are 3 main scenarios we protect against:3. **CSP is on by default** for [all Discourse installations](https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243) as of Discourse 2.2. It can be switched off in the site settings, but it is default on.-On the server side we run a whitelist based sanitizer, implemented using the [Sanitize gem](https://github.com/rgrove/sanitize). See the [relevant Discourse code](https://github.com/discourse/discourse/blob/master/lib/pretty_text.rb).+On the server side we run a allowlist based sanitizer, implemented using the [Sanitize gem](https://github.com/rgrove/sanitize). See the [relevant Discourse code](https://github.com/discourse/discourse/blob/master/lib/pretty_text.rb).In addition, titles and all other places where non-admins can enter code are protected either using the Handlebars library or standard Rails XSS protection.diff --git a/lib/auth/github_authenticator.rb b/lib/auth/github_authenticator.rbindex c76fe9a59e2..1925086217d 100644--- a/lib/auth/github_authenticator.rb+++ b/lib/auth/github_authenticator.rb@@ -113,8 +113,8 @@ class Auth::GithubAuthenticator < Auth::Authenticatorend# If we *still* don't have a user, check to see if there's an email that- # passes validation (this includes whitelist/blacklist filtering if any is- # configured). When no whitelist/blacklist is in play, this will simply+ # passes validation (this includes allowlist/blocklist filtering if any is+ # configured). When no allowlist/blocklist is in play, this will simply# choose the primary email since it's at the front of the list.if !uservalidator = EmailValidator.new(attributes: :email)diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rbindex d96d81f6836..e46295becf1 100644--- a/lib/cooked_post_processor.rb+++ b/lib/cooked_post_processor.rb@@ -592,7 +592,7 @@ class CookedPostProcessorfound = falseparent = imgwhile parent = parent.parent- if parent["class"] && parent["class"].include?("whitelistedgeneric")+ if parent["class"] && parent["class"].include?("allowlistedgeneric")found = truebreakenddiff --git a/lib/crawler_detection.rb b/lib/crawler_detection.rbindex 4a90f848652..36fb61b63e5 100644--- a/lib/crawler_detection.rb+++ b/lib/crawler_detection.rb@@ -39,18 +39,18 @@ module CrawlerDetection# Given a user_agent that returns true from crawler?, should its request be allowed?def self.allow_crawler?(user_agent)- return true if SiteSetting.whitelisted_crawler_user_agents.blank? &&- SiteSetting.blacklisted_crawler_user_agents.blank?+ return true if SiteSetting.allowed_crawler_user_agents.blank? &&+ SiteSetting.blocked_crawler_user_agents.blank?- @whitelisted_matchers ||= {}- @blacklisted_matchers ||= {}+ @allowlisted_matchers ||= {}+ @blocklisted_matchers ||= {}- if SiteSetting.whitelisted_crawler_user_agents.present?- whitelisted = @whitelisted_matchers[SiteSetting.whitelisted_crawler_user_agents] ||= to_matcher(SiteSetting.whitelisted_crawler_user_agents)- !user_agent.nil? && user_agent.match?(whitelisted)+ if SiteSetting.allowed_crawler_user_agents.present?+ allowlisted = @allowlisted_matchers[SiteSetting.allowed_crawler_user_agents] ||= to_matcher(SiteSetting.allowed_crawler_user_agents)+ !user_agent.nil? && user_agent.match?(allowlisted)else- blacklisted = @blacklisted_matchers[SiteSetting.blacklisted_crawler_user_agents] ||= to_matcher(SiteSetting.blacklisted_crawler_user_agents)- user_agent.nil? || !user_agent.match?(blacklisted)+ blocklisted = @blocklisted_matchers[SiteSetting.blocked_crawler_user_agents] ||= to_matcher(SiteSetting.blocked_crawler_user_agents)+ user_agent.nil? || !user_agent.match?(blocklisted)endenddiff --git a/lib/email/receiver.rb b/lib/email/receiver.rbindex 78e0dcb3c87..fb487084dfc 100644--- a/lib/email/receiver.rb+++ b/lib/email/receiver.rb@@ -62,7 +62,7 @@ module Emailenddef process!- return if is_blacklisted?+ return if is_blocked?id_hash = Digest::SHA1.hexdigest(@message_id)DistributedMutex.synchronize("process_email_#{id_hash}") dobegin@@ -105,7 +105,7 @@ module Emailendend- def is_blacklisted?+ def is_blocked?return false if SiteSetting.ignore_by_title.blank?Regexp.new(SiteSetting.ignore_by_title, Regexp::IGNORECASE) =~ @mail.subjectend@@ -289,7 +289,7 @@ module Emailenddef is_auto_generated?- return false if SiteSetting.auto_generated_whitelist.split('|').include?(@from_email)+ return false if SiteSetting.auto_generated_allowlist.split('|').include?(@from_email)@mail[:precedence].to_s[/list|junk|bulk|auto_reply/i] ||@mail[:from].to_s[/(mailer[\-_]?daemon|post[\-_]?master|no[\-_]?reply)@/i] ||@mail[:subject].to_s[/^\s*(Auto:|Automatic reply|Autosvar|Automatisk svar|Automatisch antwoord|Abwesenheitsnotiz|Risposta Non al computer|Automatisch antwoord|Auto Response|Respuesta automática|Fuori sede|Out of Office|Frånvaro|Réponse automatique)/i] ||@@ -1009,18 +1009,18 @@ module Emailraise InvalidPostAction.new if result.failed? && result.forbiddenend- def is_whitelisted_attachment?(attachment)- attachment.content_type !~ SiteSetting.attachment_content_type_blacklist_regex &&- attachment.filename !~ SiteSetting.attachment_filename_blacklist_regex+ def is_allowed?(attachment)+ attachment.content_type !~ SiteSetting.blocked_attachment_content_types_regex &&+ attachment.filename !~ SiteSetting.blocked_attachment_filenames_regexenddef attachments@attachments ||= begin- attachments = @mail.attachments.select { |attachment| is_whitelisted_attachment?(attachment) }- attachments << @mail if @mail.attachment? && is_whitelisted_attachment?(@mail)+ attachments = @mail.attachments.select { |attachment| is_allowed?(attachment) }+ attachments << @mail if @mail.attachment? && is_allowed?(@mail)@mail.parts.each do |part|- attachments << part if part.attachment? && is_whitelisted_attachment?(part)+ attachments << part if part.attachment? && is_allowed?(part)endattachments.uniq!diff --git a/lib/email/styles.rb b/lib/email/styles.rbindex ffd4527eb75..2126d456f98 100644--- a/lib/email/styles.rb+++ b/lib/email/styles.rb@@ -152,7 +152,7 @@ module Email# iframes can't go in emails, so replace them with clickable links@fragment.css('iframe').each do |i|begin- # sometimes, iframes are blacklisted...+ # sometimes, iframes are blocklisted...if i["src"].blank?i.removenextdiff --git a/lib/final_destination.rb b/lib/final_destination.rbindex 02930a71c8f..b5a4dcc4749 100644--- a/lib/final_destination.rb+++ b/lib/final_destination.rb@@ -284,13 +284,13 @@ class FinalDestinationdef is_dest_valid?return false unless @uri && @uri.host- # Whitelisted hosts+ # Allowlisted hostsreturn true if hostname_matches?(SiteSetting.Upload.s3_cdn_url) ||hostname_matches?(GlobalSetting.try(:cdn_url)) ||hostname_matches?(Discourse.base_url_no_prefix)- if SiteSetting.whitelist_internal_hosts.present?- return true if SiteSetting.whitelist_internal_hosts.split("|").any? { |h| h.downcase == @uri.hostname.downcase }+ if SiteSetting.allowed_internal_hosts.present?+ return true if SiteSetting.allowed_internal_hosts.split("|").any? { |h| h.downcase == @uri.hostname.downcase }endaddress_s = @opts[:lookup_ip].call(@uri.hostname)@@ -320,7 +320,7 @@ class FinalDestinationdef private_rangesFinalDestination.standard_private_ranges +- SiteSetting.blacklist_ip_blocks.split('|').map { |r| IPAddr.new(r) rescue nil }.compact+ SiteSetting.blocked_ip_blocks.split('|').map { |r| IPAddr.new(r) rescue nil }.compactenddef log(log_level, message)diff --git a/lib/flag_query.rb b/lib/flag_query.rbindex c03763d74ba..5c6c0bce9b1 100644--- a/lib/flag_query.rb+++ b/lib/flag_query.rb@@ -137,7 +137,7 @@ module FlagQueryguardian = Guardian.new(current_user)users = User.includes(:user_stat).where(id: user_ids.to_a).to_a- User.preload_custom_fields(users, User.whitelisted_user_custom_fields(guardian))+ User.preload_custom_fields(users, User.allowed_user_custom_fields(guardian))[posts,diff --git a/lib/guardian.rb b/lib/guardian.rbindex 709f386904b..9e31492c773 100644--- a/lib/guardian.rb+++ b/lib/guardian.rb@@ -477,9 +477,9 @@ class Guardiandef allowed_theme_repo_import?(repo)return false if [email protected]?- whitelisted_repos = GlobalSetting.whitelisted_theme_repos- if !whitelisted_repos.blank?- urls = whitelisted_repos.split(",").map(&:strip)+ allowed_repos = GlobalSetting.allowed_theme_repos+ if !allowed_repos.blank?+ urls = allowed_repos.split(",").map(&:strip)return urls.include?(repo)end@@ -489,8 +489,8 @@ class Guardiandef allow_themes?(theme_ids, include_preview: false)return true if theme_ids.blank?- if whitelisted_theme_ids = GlobalSetting.whitelisted_theme_ids- if (theme_ids - whitelisted_theme_ids).present?+ if allowed_theme_ids = GlobalSetting.allowed_theme_ids+ if (theme_ids - allowed_theme_ids).present?return falseendenddiff --git a/lib/guardian/post_guardian.rb b/lib/guardian/post_guardian.rbindex 2827f5462bf..d02efa61faa 100644--- a/lib/guardian/post_guardian.rb+++ b/lib/guardian/post_guardian.rb@@ -10,7 +10,7 @@ module PostGuardiandef link_posting_accessif unrestricted_link_posting?'full'- elsif SiteSetting.whitelisted_link_domains.present?+ elsif SiteSetting.allowed_link_domains.present?'limited'else'none'@@ -21,7 +21,7 @@ module PostGuardianreturn false if host.blank?unrestricted_link_posting? ||- SiteSetting.whitelisted_link_domains.split('|').include?(host)+ SiteSetting.allowed_link_domains.split('|').include?(host)end# Can the user act on the post in a particular way.diff --git a/lib/inline_oneboxer.rb b/lib/inline_oneboxer.rbindex 26f3ecc9ba6..48c01715198 100644--- a/lib/inline_oneboxer.rb+++ b/lib/inline_oneboxer.rb@@ -42,7 +42,7 @@ class InlineOneboxerendalways_allow = SiteSetting.enable_inline_onebox_on_all_domains- domains = SiteSetting.inline_onebox_domains_whitelist&.split('|') unless always_allow+ domains = SiteSetting.allowed_inline_onebox_domains&.split('|') unless always_allowif always_allow || domainsuri = begindiff --git a/lib/onebox/engine/whitelisted_generic_onebox.rb b/lib/onebox/engine/allowlisted_generic_onebox.rbsimilarity index 82%rename from lib/onebox/engine/whitelisted_generic_onebox.rbrename to lib/onebox/engine/allowlisted_generic_onebox.rbindex 7a46a0d1e5d..85af9278635 100644--- a/lib/onebox/engine/whitelisted_generic_onebox.rb+++ b/lib/onebox/engine/allowlisted_generic_onebox.rb@@ -4,9 +4,9 @@ require "ipaddr"module Oneboxmodule Engine- class WhitelistedGenericOnebox+ class AllowlistedGenericOnebox- # overwrite the whitelist+ # overwrite the allowlistdef self.===(other)other.is_a?(URI) ? (IPAddr.new(other.hostname) rescue nil).nil? : trueend@@ -18,10 +18,10 @@ module Oneboxprivate- # overwrite to whitelist iframes+ # overwrite to allowlist iframesdef is_embedded?return false unless data[:html] && data[:height]- return true if WhitelistedGenericOnebox.html_providers.include?(data[:provider_name])+ return true if AllowlistedGenericOnebox.html_providers.include?(data[:provider_name])if data[:html]["iframe"]fragment = Nokogiri::HTML5::fragment(data[:html])diff --git a/lib/oneboxer.rb b/lib/oneboxer.rbindex 107e6d0610b..a5e1c235e46 100644--- a/lib/oneboxer.rb+++ b/lib/oneboxer.rb@@ -292,8 +292,8 @@ module Oneboxerendend- def self.blacklisted_domains- SiteSetting.onebox_domains_blacklist.split("|")+ def self.blocked_domains+ SiteSetting.blocked_onebox_domains.split("|")enddef self.preserve_fragment_url_hosts@@ -304,12 +304,12 @@ module OneboxerDiscourse.cache.fetch(onebox_cache_key(url), expires_in: 1.day) dofd = FinalDestination.new(url,ignore_redirects: ignore_redirects,- ignore_hostnames: blacklisted_domains,+ ignore_hostnames: blocked_domains,force_get_hosts: force_get_hosts,force_custom_user_agent_hosts: force_custom_user_agent_hosts,preserve_fragment_url_hosts: preserve_fragment_url_hosts)uri = fd.resolve- return blank_onebox if uri.blank? || blacklisted_domains.map { |hostname| uri.hostname.match?(hostname) }.any?+ return blank_onebox if uri.blank? || blocked_domains.map { |hostname| uri.hostname.match?(hostname) }.any?options = {max_width: 695,diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rbindex 6b5ece1cd34..fe64f3b21b9 100644--- a/lib/plugin/instance.rb+++ b/lib/plugin/instance.rb@@ -161,10 +161,20 @@ class Plugin::Instanceenddef whitelist_staff_user_custom_field(field)+ Discourse.deprecate("whitelist_staff_user_custom_field is deprecated, use the allow_staff_user_custom_field.", drop_from: "2.6")+ allow_staff_user_custom_field(field)+ end++ def allow_staff_user_custom_field(field)DiscoursePluginRegistry.register_staff_user_custom_field(field, self)enddef whitelist_public_user_custom_field(field)+ Discourse.deprecate("whitelist_public_user_custom_field is deprecated, use the allow_public_user_custom_field.", drop_from: "2.6")+ allow_public_user_custom_field(field)+ end++ def allow_public_user_custom_field(field)DiscoursePluginRegistry.register_public_user_custom_field(field, self)end@@ -256,10 +266,15 @@ class Plugin::Instanceendend- # Add a post_custom_fields_whitelister block to the TopicView, respecting if the plugin is enableddef topic_view_post_custom_fields_whitelister(&block)+ Discourse.deprecate("topic_view_post_custom_fields_whitelister is deprecated, use the topic_view_post_custom_fields_allowlister.", drop_from: "2.6")+ topic_view_post_custom_fields_allowlister(&block)+ end++ # Add a post_custom_fields_allowlister block to the TopicView, respecting if the plugin is enabled+ def topic_view_post_custom_fields_allowlister(&block)reloadable_patch do |plugin|- ::TopicView.add_post_custom_fields_whitelister do |user|+ ::TopicView.add_post_custom_fields_allowlister do |user|plugin.enabled? ? block.call(user) : []endenddiff --git a/lib/pretty_text.rb b/lib/pretty_text.rbindex e17a90e44bc..03f4dcb4c30 100644--- a/lib/pretty_text.rb+++ b/lib/pretty_text.rb@@ -284,10 +284,10 @@ module PrettyTextenddef self.add_rel_nofollow_to_user_content(doc)- whitelist = []+ allowlist = []domains = SiteSetting.exclude_rel_nofollow_domains- whitelist = domains.split('|') if domains.present?+ allowlist = domains.split('|') if domains.present?site_uri = nildoc.css("a").each do |l|@@ -299,7 +299,7 @@ module PrettyTextif !uri.host.present? ||uri.host == site_uri.host ||uri.host.ends_with?(".#{site_uri.host}") ||- whitelist.any? { |u| uri.host == u || uri.host.ends_with?(".#{u}") }+ allowlist.any? { |u| uri.host == u || uri.host.ends_with?(".#{u}") }# we are good no need for nofollowl.remove_attribute("rel")elsediff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rbindex 09b616eda99..da3f6cf9814 100644--- a/lib/site_setting_extension.rb+++ b/lib/site_setting_extension.rb@@ -378,8 +378,8 @@ module SiteSettingExtensionendHOSTNAME_SETTINGS ||= %w{- disabled_image_download_domains onebox_domains_blacklist exclude_rel_nofollow_domains- email_domains_blacklist email_domains_whitelist white_listed_spam_host_domains+ disabled_image_download_domains blocked_onebox_domains exclude_rel_nofollow_domains+ blocked_email_domains allowed_email_domains allowed_spam_host_domains}def filter_value(name, value)diff --git a/lib/spam_handler.rb b/lib/spam_handler.rbindex 2071c079bbe..fc298f87665 100644--- a/lib/spam_handler.rb+++ b/lib/spam_handler.rb@@ -17,8 +17,8 @@ class SpamHandlerreturn false if staff_members_with_same_ip > 0- ip_whitelisted = ScreenedIpAddress.is_whitelisted?(ip_address)- return false if ip_whitelisted+ allowed_ip = ScreenedIpAddress.is_allowed?(ip_address)+ return false if allowed_iptl0_accounts_with_same_ip = User.unscoped.where(trust_level: TrustLevel[0])diff --git a/lib/tasks/typepad.thor b/lib/tasks/typepad.thorindex cb6eb8b6e5e..649f12db523 100644--- a/lib/tasks/typepad.thor+++ b/lib/tasks/typepad.thor@@ -13,7 +13,7 @@ class Typepad < Thorrequire './config/environment'backup_settings = {}- %w(email_domains_blacklist).each do |s|+ %w(blocked_email_domains).each do |s|backup_settings[s] = SiteSetting.get(s)end@@ -53,7 +53,7 @@ class Typepad < ThorendRateLimiter.disable- SiteSetting.email_domains_blacklist = ""+ SiteSetting.blocked_email_domains = ""puts "Importing #{entries.size} entries"diff --git a/lib/topic_view.rb b/lib/topic_view.rbindex 81b4449c4ed..0601a59f0c6 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -38,16 +38,16 @@ class TopicView@default_post_custom_fields ||= [Post::NOTICE_TYPE, Post::NOTICE_ARGS, "action_code_who"]end- def self.post_custom_fields_whitelisters- @post_custom_fields_whitelisters ||= Set.new+ def self.post_custom_fields_allowlisters+ @post_custom_fields_allowlisters ||= Set.newend- def self.add_post_custom_fields_whitelister(&block)- post_custom_fields_whitelisters << block+ def self.add_post_custom_fields_allowlister(&block)+ post_custom_fields_allowlisters << blockend- def self.whitelisted_post_custom_fields(user)- wpcf = default_post_custom_fields + post_custom_fields_whitelisters.map { |w| w.call(user) }+ def self.allowed_post_custom_fields(user)+ wpcf = default_post_custom_fields + post_custom_fields_allowlisters.map { |w| w.call(user) }wpcf.flatten.uniqend@@ -87,12 +87,12 @@ class TopicViewfilter_posts(options)if @posts && !@skip_custom_fields- if (added_fields = User.whitelisted_user_custom_fields(@guardian)).present?+ if (added_fields = User.allowed_user_custom_fields(@guardian)).present?@user_custom_fields = User.custom_fields_for_ids(@posts.pluck(:user_id), added_fields)end- if (whitelisted_fields = TopicView.whitelisted_post_custom_fields(@user)).present?- @post_custom_fields = Post.custom_fields_for_ids(@posts.pluck(:id), whitelisted_fields)+ if (allowed_fields = TopicView.allowed_post_custom_fields(@user)).present?+ @post_custom_fields = Post.custom_fields_for_ids(@posts.pluck(:id), allowed_fields)endenddiff --git a/lib/upload_creator.rb b/lib/upload_creator.rbindex acab69e9c07..f3d76cb2856 100644--- a/lib/upload_creator.rb+++ b/lib/upload_creator.rb@@ -51,7 +51,7 @@ class UploadCreatorreturn @upload if @upload.errors.present?if @image_info.type.to_s == "svg"- whitelist_svg!+ clean_svg!elsif !Rails.env.test? || @opts[:force_optimize]convert_to_jpeg! if convert_png_to_jpeg?downsize! if should_downsize?@@ -302,9 +302,9 @@ class UploadCreatorendend- def whitelist_svg!+ def clean_svg!doc = Nokogiri::XML(@file)- doc.xpath(svg_whitelist_xpath).remove+ doc.xpath(svg_allowlist_xpath).removedoc.xpath("//@*[starts-with(name(), 'on')]").removedoc.css('use').each do |use_el|if use_el.attr('href')@@ -400,8 +400,8 @@ class UploadCreator@allow_animation ||= @opts[:type] == "avatar" ? SiteSetting.allow_animated_avatars : SiteSetting.allow_animated_thumbnailsend- def svg_whitelist_xpath- @@svg_whitelist_xpath ||= "//*[#{WHITELISTED_SVG_ELEMENTS.map { |e| "name()!='#{e}'" }.join(" and ") }]"+ def svg_allowlist_xpath+ @@svg_allowlist_xpath ||= "//*[#{WHITELISTED_SVG_ELEMENTS.map { |e| "name()!='#{e}'" }.join(" and ") }]"enddef add_metadata!diff --git a/lib/upload_recovery.rb b/lib/upload_recovery.rbindex fc687d7fd30..7ea190c02d8 100644--- a/lib/upload_recovery.rb+++ b/lib/upload_recovery.rb@@ -17,7 +17,7 @@ class UploadRecoveryanalyzer.cooked_stripped.css("img", "a").each do |media|if media.name == "img" && orig_src = media["data-orig-src"]if dom_class = media["class"]- if (Post.white_listed_image_classes & dom_class.split).count > 0+ if (Post.allowed_image_classes & dom_class.split).count > 0nextendenddiff --git a/lib/user_name_suggester.rb b/lib/user_name_suggester.rbindex 2f7c7c920ab..ecd482b4900 100644--- a/lib/user_name_suggester.rb+++ b/lib/user_name_suggester.rb@@ -115,7 +115,7 @@ module UserNameSuggesterendname.gsub!(UsernameValidator.invalid_char_pattern, '_')- name = apply_whitelist(name) if UsernameValidator.char_whitelist_exists?+ name = apply_allowlist(name) if UsernameValidator.char_allowlist_exists?name.gsub!(UsernameValidator::INVALID_LEADING_CHAR_PATTERN, '')name.gsub!(UsernameValidator::CONFUSING_EXTENSIONS, "_")name.gsub!(UsernameValidator::INVALID_TRAILING_CHAR_PATTERN, '')@@ -123,9 +123,9 @@ module UserNameSuggesternameend- def self.apply_whitelist(name)+ def self.apply_allowlist(name)name.grapheme_clusters- .map { |c| UsernameValidator.whitelisted_char?(c) ? c : '_' }+ .map { |c| UsernameValidator.allowed_char?(c) ? c : '_' }.joinenddiff --git a/lib/validators/email_validator.rb b/lib/validators/email_validator.rbindex 7090f2516b1..47200da2b9f 100644--- a/lib/validators/email_validator.rb+++ b/lib/validators/email_validator.rb@@ -17,9 +17,9 @@ class EmailValidator < ActiveModel::EachValidatorenddef self.allowed?(email)- if (setting = SiteSetting.email_domains_whitelist).present?+ if (setting = SiteSetting.allowed_email_domains).present?return email_in_restriction_setting?(setting, email) || is_developer?(email)- elsif (setting = SiteSetting.email_domains_blacklist).present?+ elsif (setting = SiteSetting.blocked_email_domains).present?return !(email_in_restriction_setting?(setting, email) && !is_developer?(email))enddiff --git a/lib/validators/unicode_username_whitelist_validator.rb b/lib/validators/unicode_username_allowlist_validator.rbsimilarity index 59%rename from lib/validators/unicode_username_whitelist_validator.rbrename to lib/validators/unicode_username_allowlist_validator.rbindex 21aabe6eee2..f47d37b92f5 100644--- a/lib/validators/unicode_username_whitelist_validator.rb+++ b/lib/validators/unicode_username_allowlist_validator.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-class UnicodeUsernameWhitelistValidator+class UnicodeUsernameAllowlistValidatordef initialize(opts = {})@opts = optsend@@ -10,12 +10,12 @@ class UnicodeUsernameWhitelistValidatorreturn true if value.blank?if value.match?(/^\/.*\/[imxo]*$/)- @error_message = I18n.t("site_settings.errors.unicode_username_whitelist.leading_trailing_slash")+ @error_message = I18n.t("site_settings.errors.allowed_unicode_usernames.leading_trailing_slash")elsebeginRegexp.new(value)rescue RegexpError => e- @error_message = I18n.t("site_settings.errors.unicode_username_whitelist.regex_invalid", error: e.message)+ @error_message = I18n.t("site_settings.errors.allowed_unicode_usernames.regex_invalid", error: e.message)endenddiff --git a/lib/validators/upload_validator.rb b/lib/validators/upload_validator.rbindex deb49854bf6..4238a77ff97 100644--- a/lib/validators/upload_validator.rb+++ b/lib/validators/upload_validator.rb@@ -12,9 +12,9 @@ class UploadValidator < ActiveModel::Validatorreturn true if upload.user&.staff?end- # check the attachment blacklist+ # check the attachment blocklistif upload.for_group_message && SiteSetting.allow_all_attachments_for_group_messages- return upload.original_filename =~ SiteSetting.attachment_filename_blacklist_regex+ return upload.original_filename =~ SiteSetting.blocked_attachment_filenames_regexendextension = File.extname(upload.original_filename)[1..-1] || ""diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rbindex ec4a7570a6d..8331b8fca63 100644--- a/plugins/poll/plugin.rb+++ b/plugins/poll/plugin.rb@@ -562,7 +562,7 @@ after_initialize doregister_post_custom_field_type(DiscoursePoll::HAS_POLLS, :boolean)- topic_view_post_custom_fields_whitelister { [DiscoursePoll::HAS_POLLS] }+ topic_view_post_custom_fields_allowlister { [DiscoursePoll::HAS_POLLS] }add_to_class(:topic_view, :polls) do@polls ||= begindiff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rbindex 64de94ba75f..bc780e68869 100644--- a/script/import_scripts/base.rb+++ b/script/import_scripts/base.rb@@ -70,7 +70,7 @@ class ImportScripts::Basedef get_site_settings_for_import{- email_domains_blacklist: '',+ blocked_email_domains: '',min_topic_title_length: 1,min_post_length: 1,min_first_post_length: 1,diff --git a/script/import_scripts/friendsmegplus.rb b/script/import_scripts/friendsmegplus.rbindex 3eb76239515..ee22dd9cbca 100644--- a/script/import_scripts/friendsmegplus.rb+++ b/script/import_scripts/friendsmegplus.rb@@ -68,12 +68,12 @@ class ImportScripts::FMGP < ImportScripts::Base@usermap = {}# G+ user IDs to filter out (spam, abuse) — no topics or posts, silence and suspend when creating- # loaded from blacklist.json as array of google ids `[ 92310293874, 12378491235293 ]`- @blacklist = Set[]+ # loaded from blocklist.json as array of google ids `[ 92310293874, 12378491235293 ]`+ @blocklist = Set[]# G+ user IDs whose posts are useful; if this is set, include only- # posts (and non-blacklisted comments) authored by these IDs- @whitelist = nil+ # posts (and non-blocklisted comments) authored by these IDs+ @allowlist = nil# Tags to apply to every topic; empty Array to not have any tags applied everywhere@globaltags = [ "gplus" ]@@ -117,10 +117,10 @@ class ImportScripts::FMGP < ImportScripts::Base@categories = load_fmgp_json(arg)elsif arg.end_with?("usermap.json")@usermap = load_fmgp_json(arg)- elsif arg.end_with?('blacklist.json')- @blacklist = load_fmgp_json(arg).map { |i| i.to_s }.to_set- elsif arg.end_with?('whitelist.json')- @whitelist = load_fmgp_json(arg).map { |i| i.to_s }.to_set+ elsif arg.end_with?('blocklist.json')+ @blocklist = load_fmgp_json(arg).map { |i| i.to_s }.to_set+ elsif arg.end_with?('allowlist.json')+ @allowlist = load_fmgp_json(arg).map { |i| i.to_s }.to_setelsif arg.end_with?('.json')@feeds << load_fmgp_json(arg)elsif arg == '--dry-run'@@ -149,8 +149,8 @@ class ImportScripts::FMGP < ImportScripts::Base@posts_imported = 0@topics_skipped = 0@posts_skipped = 0- @topics_blacklisted = 0- @posts_blacklisted = 0+ @blocked_topics = 0+ @blocked_posts = 0# count uploaded file size@totalsize = 0@@ -324,10 +324,10 @@ class ImportScripts::FMGP < ImportScripts::Basenewuser.approved = truenewuser.approved_by_id = @system_user.idnewuser.approved_at = newuser.created_at- if @blacklist.include?(id.to_s)+ if @blocklist.include?(id.to_s)now = DateTime.nowforever = 1000.years.from_now- # you can suspend as well if you want your blacklist to+ # you can suspend as well if you want your blocklist to# be hard to recover from#newuser.suspended_at = now#newuser.suspended_till = forever@@ -348,7 +348,7 @@ class ImportScripts::FMGP < ImportScripts::Base# user already on systemu = User.find(google_user_info.user_id)if u.silenced? || u.suspended?- @blacklist.add(id)+ @blocklist.add(id)end@users[id] = uemail = u.email@@ -371,7 +371,7 @@ class ImportScripts::FMGP < ImportScripts::Basecategory["posts"].each do |post|# G+ post / Discourse topicimport_topic(post, category)- print("\r#{@topics_imported}/#{@posts_imported} topics/posts (skipped: #{@topics_skipped}/#{@posts_skipped} blacklisted: #{@topics_blacklisted}/#{@posts_blacklisted}) ")+ print("\r#{@topics_imported}/#{@posts_imported} topics/posts (skipped: #{@topics_skipped}/#{@posts_skipped} blocklisted: #{@blocked_topics}/#{@blocked_posts}) ")endendend@@ -389,13 +389,13 @@ class ImportScripts::FMGP < ImportScripts::Base@topics_skipped += 1else# new post- if [email protected]? && [email protected]?(post["author"]["id"])- # only ignore non-whitelisted if whitelist defined+ if [email protected]? && [email protected]?(post["author"]["id"])+ # only ignore non-allowlisted if allowlist definedreturnendpostmap = make_postmap(post, category, nil)if postmap.nil?- @topics_blacklisted += 1+ @blocked_topics += 1returnendp = create_post(postmap, postmap[:id]) if !@dryrun@@ -409,7 +409,7 @@ class ImportScripts::FMGP < ImportScripts::Baseelsecommentmap = make_postmap(comment, nil, p)if commentmap.nil?- @posts_blacklisted += 1+ @blocked_posts += 1else@posts_imported += 1new_comment = create_post(commentmap, commentmap[:id]) if !@dryrun@@ -420,7 +420,7 @@ class ImportScripts::FMGP < ImportScripts::Basedef make_postmap(post, category, parent)post_author_id = post["author"]["id"]- return nil if @blacklist.include?(post_author_id.to_s)+ return nil if @blocklist.include?(post_author_id.to_s)raw = formatted_message(post)# if no message, image, or images, it's just emptydiff --git a/script/import_scripts/smf1.rb b/script/import_scripts/smf1.rbindex 99f068c5ed8..5f83eef6734 100644--- a/script/import_scripts/smf1.rb+++ b/script/import_scripts/smf1.rb@@ -497,10 +497,10 @@ class ImportScripts::Smf1 < ImportScripts::Basedef import_banned_domainsputs "", "Importing banned email domains..."- blacklist = SiteSetting.email_domains_blacklist.split("|")+ blocklist = SiteSetting.blocked_email_domains.split("|")banned_domains = mysql_query("SELECT SUBSTRING(email_address, 3) domain FROM smf_ban_items WHERE email_address RLIKE '^%@[^%]+$' GROUP BY email_address").map { |r| r["domain"] }- SiteSetting.email_domains_blacklist = (blacklist + banned_domains).uniq.sort.join("|")+ SiteSetting.blocked_email_domains = (blocklist + banned_domains).uniq.sort.join("|")enddef import_banned_emailsdiff --git a/spec/components/auth/github_authenticator_spec.rb b/spec/components/auth/github_authenticator_spec.rbindex ae50424c904..b9a9f4788df 100644--- a/spec/components/auth/github_authenticator_spec.rb+++ b/spec/components/auth/github_authenticator_spec.rb@@ -178,38 +178,38 @@ describe Auth::GithubAuthenticator doexpect(result.email_valid).to eq(hash[:info][:email].present?)end- it 'will skip blacklisted domains for non existing users' do+ it 'will skip blocklisted domains for non existing users' dohash = {extra: {all_emails: [{- email: "[email protected]",+ email: "[email protected]",primary: true,verified: true,}, {- email: "[email protected]",+ email: "[email protected]",primary: false,verified: true,}]},info: {- email: "[email protected]",+ email: "[email protected]",nickname: "person",name: "Person Lastname",},uid: "100"}- SiteSetting.email_domains_blacklist = "blacklist.com"+ SiteSetting.blocked_email_domains = "blocklist.com"result = authenticator.after_authenticate(hash)expect(result.user).to eq(nil)expect(result.username).to eq(hash[:info][:nickname])expect(result.name).to eq(hash[:info][:name])- expect(result.email).to eq("[email protected]")+ expect(result.email).to eq("[email protected]")expect(result.email_valid).to eq(true)end- it 'will find whitelisted domains for non existing users' do+ it 'will find allowlisted domains for non existing users' dohash = {extra: {all_emails: [{@@ -217,11 +217,11 @@ describe Auth::GithubAuthenticator doprimary: true,verified: true,}, {- email: "[email protected]",+ email: "[email protected]",primary: false,verified: true,}, {- email: "[email protected]",+ email: "[email protected]",primary: false,verified: true,}]@@ -234,13 +234,13 @@ describe Auth::GithubAuthenticator douid: "100"}- SiteSetting.email_domains_whitelist = "whitelist.com"+ SiteSetting.allowed_email_domains = "allowlist.com"result = authenticator.after_authenticate(hash)expect(result.user).to eq(nil)expect(result.username).to eq(hash[:info][:nickname])expect(result.name).to eq(hash[:info][:name])- expect(result.email).to eq("[email protected]")+ expect(result.email).to eq("[email protected]")expect(result.email_valid).to eq(true)enddiff --git a/spec/components/concern/has_custom_fields_spec.rb b/spec/components/concern/has_custom_fields_spec.rbindex 24ecefaca54..a567f3e8eda 100644--- a/spec/components/concern/has_custom_fields_spec.rb+++ b/spec/components/concern/has_custom_fields_spec.rb@@ -235,7 +235,7 @@ describe HasCustomFields doit "supports bulk retrieval with a list of ids" doitem1 = CustomFieldsTestItem.new- item1.custom_fields = { "a" => ["b", "c", "d"], 'not_whitelisted' => 'secret' }+ item1.custom_fields = { "a" => ["b", "c", "d"], 'not_allowlisted' => 'secret' }item1.saveitem2 = CustomFieldsTestItem.new@@ -245,7 +245,7 @@ describe HasCustomFields dofields = CustomFieldsTestItem.custom_fields_for_ids([item1.id, item2.id], ['a', 'e'])expect(fields).to be_presentexpect(fields[item1.id]['a']).to match_array(['b', 'c', 'd'])- expect(fields[item1.id]['not_whitelisted']).to be_blank+ expect(fields[item1.id]['not_allowlisted']).to be_blankexpect(fields[item2.id]['e']).to eq('hallo')enddiff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rbindex a4b9c2bc143..dc202453248 100644--- a/spec/components/cooked_post_processor_spec.rb+++ b/spec/components/cooked_post_processor_spec.rb@@ -1600,7 +1600,7 @@ describe CookedPostProcessor docontext "onebox" dobefore doOneboxer.stubs(:onebox).with(anything, anything).returns(nil)- Oneboxer.stubs(:onebox).with('https://discourse.org', anything).returns("<aside class=\"onebox whitelistedgeneric\">the rest of the onebox</aside>")+ Oneboxer.stubs(:onebox).with('https://discourse.org', anything).returns("<aside class=\"onebox allowlistedgeneric\">the rest of the onebox</aside>")endit "awards the badge for using an onebox" dodiff --git a/spec/components/crawler_detection_spec.rb b/spec/components/crawler_detection_spec.rbindex 1492d010fb5..c5f2a2056b9 100644--- a/spec/components/crawler_detection_spec.rb+++ b/spec/components/crawler_detection_spec.rb@@ -70,13 +70,13 @@ describe CrawlerDetection doenddescribe 'allow_crawler?' do- it 'returns true if whitelist and blacklist are blank' do+ it 'returns true if allowlist and blocklist are blank' doexpect(CrawlerDetection.allow_crawler?('Googlebot/2.1 (+http://www.google.com/bot.html)')).to eq(true)end- context 'whitelist is set' do+ context 'allowlist is set' dobefore do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot|Twitterbot'+ SiteSetting.allowed_crawler_user_agents = 'Googlebot|Twitterbot'endit 'returns true for matching user agents' do@@ -91,20 +91,20 @@ describe CrawlerDetection doexpect(CrawlerDetection.allow_crawler?('')).to eq(false)end- context 'and blacklist is set' do+ context 'and blocklist is set' dobefore do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot-Image'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot-Image'end- it 'ignores the blacklist' do+ it 'ignores the blocklist' doexpect(CrawlerDetection.allow_crawler?('Googlebot-Image/1.0')).to eq(true)endendend- context 'blacklist is set' do+ context 'blocklist is set' dobefore do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot|Twitterbot'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot|Twitterbot'endit 'returns true for crawlers that do not match' do@@ -122,47 +122,47 @@ describe CrawlerDetection doenddescribe 'is_blocked_crawler?' do- it 'is false if user agent is a crawler and no whitelist or blacklist is defined' do+ it 'is false if user agent is a crawler and no allowlist or blocklist is defined' doexpect(CrawlerDetection.is_blocked_crawler?('Twitterbot')).to eq(false)end- it 'is false if user agent is not a crawler and no whitelist or blacklist is defined' do+ it 'is false if user agent is not a crawler and no allowlist or blocklist is defined' doexpect(CrawlerDetection.is_blocked_crawler?('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')).to eq(false)end- it 'is true if user agent is a crawler and is not whitelisted' do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot'+ it 'is true if user agent is a crawler and is not allowlisted' do+ SiteSetting.allowed_crawler_user_agents = 'Googlebot'expect(CrawlerDetection.is_blocked_crawler?('Twitterbot')).to eq(true)end- it 'is false if user agent is not a crawler and there is a whitelist' do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot'+ it 'is false if user agent is not a crawler and there is a allowlist' do+ SiteSetting.allowed_crawler_user_agents = 'Googlebot'expect(CrawlerDetection.is_blocked_crawler?('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')).to eq(false)end- it 'is true if user agent is a crawler and is blacklisted' do- SiteSetting.blacklisted_crawler_user_agents = 'Twitterbot'+ it 'is true if user agent is a crawler and is blocklisted' do+ SiteSetting.blocked_crawler_user_agents = 'Twitterbot'expect(CrawlerDetection.is_blocked_crawler?('Twitterbot')).to eq(true)end- it 'is true if user agent is a crawler and is not blacklisted' do- SiteSetting.blacklisted_crawler_user_agents = 'Twitterbot'+ it 'is true if user agent is a crawler and is not blocklisted' do+ SiteSetting.blocked_crawler_user_agents = 'Twitterbot'expect(CrawlerDetection.is_blocked_crawler?('Googlebot')).to eq(false)end- it 'is false if user agent is not a crawler and blacklist is defined' do- SiteSetting.blacklisted_crawler_user_agents = 'Mozilla'+ it 'is false if user agent is not a crawler and blocklist is defined' do+ SiteSetting.blocked_crawler_user_agents = 'Mozilla'expect(CrawlerDetection.is_blocked_crawler?('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')).to eq(false)end- it 'is true if user agent is missing and whitelist is defined' do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot'+ it 'is true if user agent is missing and allowlist is defined' do+ SiteSetting.allowed_crawler_user_agents = 'Googlebot'expect(CrawlerDetection.is_blocked_crawler?('')).to eq(true)expect(CrawlerDetection.is_blocked_crawler?(nil)).to eq(true)end- it 'is false if user agent is missing and blacklist is defined' do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ it 'is false if user agent is missing and blocklist is defined' do+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'expect(CrawlerDetection.is_blocked_crawler?('')).to eq(false)expect(CrawlerDetection.is_blocked_crawler?(nil)).to eq(false)enddiff --git a/spec/components/email/receiver_spec.rb b/spec/components/email/receiver_spec.rbindex 44dae0fd8da..5cd9b9946cc 100644--- a/spec/components/email/receiver_spec.rb+++ b/spec/components/email/receiver_spec.rb@@ -25,16 +25,16 @@ describe Email::Receiver doexpect { process(:screened_email) }.to raise_error(Email::Receiver::ScreenedEmailError)end- it "raises EmailNotAllowed when email address is not on whitelist" do- SiteSetting.email_domains_whitelist = "example.com|bar.com"+ it "raises EmailNotAllowed when email address is not on allowlist" do+ SiteSetting.allowed_email_domains = "example.com|bar.com"Fabricate(:group, incoming_email: "[email protected]")- expect { process(:blacklist_whitelist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)+ expect { process(:blocklist_allowlist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)end- it "raises EmailNotAllowed when email address is on blacklist" do- SiteSetting.email_domains_blacklist = "email.com|mail.com"+ it "raises EmailNotAllowed when email address is on blocklist" do+ SiteSetting.blocked_email_domains = "email.com|mail.com"Fabricate(:group, incoming_email: "[email protected]")- expect { process(:blacklist_whitelist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)+ expect { process(:blocklist_allowlist_email) }.to raise_error(Email::Receiver::EmailNotAllowed)endit "raises an UserNotFoundError when staged users are disabled" do@@ -419,9 +419,9 @@ describe Email::Receiver doexpect { process(:invalid_from_2) }.to raise_error(Email::Receiver::NoSenderDetectedError)end- it "doesn't raise an AutoGeneratedEmailError when the mail is auto generated but is whitelisted" do- SiteSetting.auto_generated_whitelist = "[email protected]|[email protected]"- expect { process(:auto_generated_whitelisted) }.to change { topic.posts.count }+ it "doesn't raise an AutoGeneratedEmailError when the mail is auto generated but is allowlisted" do+ SiteSetting.auto_generated_allowlist = "[email protected]|[email protected]"+ expect { process(:auto_generated_allowlisted) }.to change { topic.posts.count }endit "doesn't raise an AutoGeneratedEmailError when block_auto_generated_emails is disabled" do@@ -1211,41 +1211,41 @@ describe Email::Receiver doinclude_examples "does not create staged users", :unsubscribe_new_user, Email::Receiver::UnsubscribeNotAllowedend- context "when From email address is not on whitelist" do+ context "when From email address is not on allowlist" dobefore do- SiteSetting.email_domains_whitelist = "example.com|bar.com"+ SiteSetting.allowed_email_domains = "example.com|bar.com"Fabricate(:group, incoming_email: "[email protected]")end- include_examples "does not create staged users", :blacklist_whitelist_email, Email::Receiver::EmailNotAllowed+ include_examples "does not create staged users", :blocklist_allowlist_email, Email::Receiver::EmailNotAllowedend- context "when From email address is on blacklist" do+ context "when From email address is on blocklist" dobefore do- SiteSetting.email_domains_blacklist = "email.com|mail.com"+ SiteSetting.blocked_email_domains = "email.com|mail.com"Fabricate(:group, incoming_email: "[email protected]")end- include_examples "does not create staged users", :blacklist_whitelist_email, Email::Receiver::EmailNotAllowed+ include_examples "does not create staged users", :blocklist_allowlist_email, Email::Receiver::EmailNotAllowedend- context "blacklist and whitelist for To and Cc" do+ context "blocklist and allowlist for To and Cc" dobefore doFabricate(:group, incoming_email: "[email protected]")end- it "does not create staged users for email addresses not on whitelist" do- SiteSetting.email_domains_whitelist = "mail.com|example.com"- process(:blacklist_whitelist_email)+ it "does not create staged users for email addresses not on allowlist" do+ SiteSetting.allowed_email_domains = "mail.com|example.com"+ process(:blocklist_allowlist_email)expect(User.find_by_email("[email protected]")).to be_nilexpect(User.find_by_email("[email protected]")).to be_nilexpect(User.find_by_email("[email protected]")).to be_presentend- it "does not create staged users for email addresses on blacklist" do- SiteSetting.email_domains_blacklist = "email.com|foo.com"- process(:blacklist_whitelist_email)+ it "does not create staged users for email addresses on blocklist" do+ SiteSetting.blocked_email_domains = "email.com|foo.com"+ process(:blocklist_allowlist_email)expect(User.find_by_email("[email protected]")).to be_nilexpect(User.find_by_email("[email protected]")).to be_nildiff --git a/spec/components/final_destination_spec.rb b/spec/components/final_destination_spec.rbindex 33f7bf19cb8..ff61289e8af 100644--- a/spec/components/final_destination_spec.rb+++ b/spec/components/final_destination_spec.rb@@ -396,7 +396,7 @@ describe FinalDestination doendit "returns false for IPV6 via site settings" do- SiteSetting.blacklist_ip_blocks = '2001:abc:de::/48|2002:abc:de::/48'+ SiteSetting.blocked_ip_blocks = '2001:abc:de::/48|2002:abc:de::/48'expect(fd('https://[2001:abc:de:01:0:3f0:6a65:c2bf]').is_dest_valid?).to eq(false)expect(fd('https://[2002:abc:de:01:0:3f0:6a65:c2bf]').is_dest_valid?).to eq(false)expect(fd('https://internal-ipv6.com').is_dest_valid?).to eq(false)@@ -404,7 +404,7 @@ describe FinalDestination doendit "ignores invalid ranges" do- SiteSetting.blacklist_ip_blocks = '2001:abc:de::/48|eviltrout'+ SiteSetting.blocked_ip_blocks = '2001:abc:de::/48|eviltrout'expect(fd('https://[2001:abc:de:01:0:3f0:6a65:c2bf]').is_dest_valid?).to eq(false)end@@ -432,8 +432,8 @@ describe FinalDestination doexpect(fd("https://cdn.example.com/some/asset").is_dest_valid?).to eq(true)end- it 'supports whitelisting via a site setting' do- SiteSetting.whitelist_internal_hosts = 'private-host.com'+ it 'supports allowlisting via a site setting' do+ SiteSetting.allowed_internal_hosts = 'private-host.com'expect(fd("https://private-host.com/some/url").is_dest_valid?).to eq(true)endenddiff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rbindex 60dc6c9a0f4..59dd96aa900 100644--- a/spec/components/guardian_spec.rb+++ b/spec/components/guardian_spec.rb@@ -51,8 +51,8 @@ describe Guardian doexpect(Guardian.new(user).link_posting_access).to eq('none')end- it "is limited for a user of a low trust level with a whitelist" do- SiteSetting.whitelisted_link_domains = 'example.com'+ it "is limited for a user of a low trust level with a allowlist" do+ SiteSetting.allowed_link_domains = 'example.com'user.trust_level = 0SiteSetting.min_trust_to_post_links = 1expect(Guardian.new(user).link_posting_access).to eq('limited')@@ -78,9 +78,9 @@ describe Guardian doexpect(Guardian.new(user).can_post_link?(host: host)).to eq(false)end- describe "whitelisted host" do+ describe "allowlisted host" dobefore do- SiteSetting.whitelisted_link_domains = host+ SiteSetting.allowed_link_domains = hostendit "allows a new user to post the link to the host" do@@ -2931,17 +2931,17 @@ describe Guardian dolet!(:theme) { Fabricate(:theme) }let!(:theme2) { Fabricate(:theme) }- context "whitelist mode" do+ context "allowlist mode" dobefore do- GlobalSetting.reset_whitelisted_theme_ids!- global_setting :whitelisted_theme_repos, " https://magic.com/repo.git, https://x.com/git"+ GlobalSetting.reset_allowed_theme_ids!+ global_setting :allowed_theme_repos, " https://magic.com/repo.git, https://x.com/git"endafter do- GlobalSetting.reset_whitelisted_theme_ids!+ GlobalSetting.reset_allowed_theme_ids!end- it "should respect theme whitelisting" do+ it "should respect theme allowlisting" dor = RemoteTheme.create!(remote_url: "https://magic.com/repo.git")theme.update!(remote_theme_id: r.id)diff --git a/spec/components/inline_oneboxer_spec.rb b/spec/components/inline_oneboxer_spec.rbindex 47c5abd6bb5..d00c9822ccc 100644--- a/spec/components/inline_oneboxer_spec.rb+++ b/spec/components/inline_oneboxer_spec.rb@@ -116,7 +116,7 @@ describe InlineOneboxer doexpect(onebox[:title]).to eq("Hello 🍕 with an emoji")end- it "will not crawl domains that aren't whitelisted" do+ it "will not crawl domains that aren't allowlisted" doonebox = InlineOneboxer.lookup("https://eviltrout.com", skip_cache: true)expect(onebox).to be_blankend@@ -153,8 +153,8 @@ describe InlineOneboxer doexpect(onebox[:title]).to eq(nil)end- it "will lookup whitelisted domains" do- SiteSetting.inline_onebox_domains_whitelist = "eviltrout.com"+ it "will lookup allowlisted domains" do+ SiteSetting.allowed_inline_onebox_domains = "eviltrout.com"RetrieveTitle.stubs(:crawl).returns("Evil Trout's Blog")onebox = InlineOneboxer.lookup(diff --git a/spec/components/middleware/anonymous_cache_spec.rb b/spec/components/middleware/anonymous_cache_spec.rbindex d6dcdb27a4f..3cb42ce8b48 100644--- a/spec/components/middleware/anonymous_cache_spec.rb+++ b/spec/components/middleware/anonymous_cache_spec.rb@@ -215,8 +215,8 @@ describe Middleware::AnonymousCache::Helper do@status, @response_header, @response = middleware.call(@env)end- it "applies whitelisted_crawler_user_agents correctly" do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot'+ it "applies allowed_crawler_user_agents correctly" do+ SiteSetting.allowed_crawler_user_agents = 'Googlebot'get '/', headers: {'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'@@ -236,7 +236,7 @@ describe Middleware::AnonymousCache::Helper doendit "doesn't block api requests" do- SiteSetting.whitelisted_crawler_user_agents = 'Googlebot'+ SiteSetting.allowed_crawler_user_agents = 'Googlebot'api_key = Fabricate(:api_key)get "/latest?api_key=#{api_key.key}&api_username=system", headers: {@@ -245,8 +245,8 @@ describe Middleware::AnonymousCache::Helper doexpect(@status).to eq(200)end- it "applies blacklisted_crawler_user_agents correctly" do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ it "applies blocked_crawler_user_agents correctly" do+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'get '/', headers: non_crawlerexpect(@status).to eq(200)@@ -265,7 +265,7 @@ describe Middleware::AnonymousCache::Helper doendit "should never block robots.txt" do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'get '/robots.txt', headers: {'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'@@ -275,7 +275,7 @@ describe Middleware::AnonymousCache::Helper doendit "should never block srv/status" do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'get '/srv/status', headers: {'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'@@ -285,7 +285,7 @@ describe Middleware::AnonymousCache::Helper doendit "blocked crawlers shouldn't log page views" do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'get '/', headers: {'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'@@ -295,7 +295,7 @@ describe Middleware::AnonymousCache::Helper doendit "blocks json requests" do- SiteSetting.blacklisted_crawler_user_agents = 'Googlebot'+ SiteSetting.blocked_crawler_user_agents = 'Googlebot'get '/srv/status.json', headers: {'HTTP_USER_AGENT' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'diff --git a/spec/components/middleware/request_tracker_spec.rb b/spec/components/middleware/request_tracker_spec.rbindex 67efd8c975e..7b36e61f20f 100644--- a/spec/components/middleware/request_tracker_spec.rb+++ b/spec/components/middleware/request_tracker_spec.rb@@ -343,7 +343,7 @@ describe Middleware::RequestTracker dotracker.call(env("REQUEST_URI" => uri, "ANON_CACHE_DURATION" => 60))expect(@data[:cache]).to eq("true")- # not whitelisted+ # not allowlistedrequest_params.delete("a")expect(@env["action_dispatch.request.parameters"]).to eq(request_params)diff --git a/spec/components/onebox/engine/allowlisted_generic_onebox_spec.rb b/spec/components/onebox/engine/allowlisted_generic_onebox_spec.rbnew file mode 100644index 00000000000..756ac1fa6f6--- /dev/null+++ b/spec/components/onebox/engine/allowlisted_generic_onebox_spec.rb@@ -0,0 +1,49 @@+# frozen_string_literal: true++require 'rails_helper'+require 'oneboxer'++describe Onebox::Engine::AllowlistedGenericOnebox do++ describe ".===" do++ it "matches any domain" do+ expect(described_class === URI('http://foo.bar/resource')).to be(true)+ end++ it "doesn't match an IP address" do+ expect(described_class === URI('http://1.2.3.4/resource')).to be(false)+ expect(described_class === URI('http://1.2.3.4:1234/resource')).to be(false)+ end++ end++ it "allowlists iframes" do+ allowlisted_body = '<html><head><link rel="alternate" type="application/json+oembed" href="https://allowlist.ed/iframes.json" />'+ blocklisted_body = '<html><head><link rel="alternate" type="application/json+oembed" href="https://blocklist.ed/iframes.json" />'++ allowlisted_oembed = {+ type: "rich",+ height: "100",+ html: "<iframe src='https://ifram.es/foo/bar'></iframe>"+ }++ blocklisted_oembed = {+ type: "rich",+ height: "100",+ html: "<iframe src='https://malicious/discourse.org/'></iframe>"+ }++ stub_request(:get, "https://blocklist.ed/iframes").to_return(status: 200, body: blocklisted_body)+ stub_request(:get, "https://blocklist.ed/iframes.json").to_return(status: 200, body: blocklisted_oembed.to_json)++ stub_request(:get, "https://allowlist.ed/iframes").to_return(status: 200, body: allowlisted_body)+ stub_request(:get, "https://allowlist.ed/iframes.json").to_return(status: 200, body: allowlisted_oembed.to_json)++ SiteSetting.allowed_iframes = "discourse.org|https://ifram.es"++ expect(Onebox.preview("https://blocklist.ed/iframes").to_s).to be_empty+ expect(Onebox.preview("https://allowlist.ed/iframes").to_s).to match("iframe src")+ end++enddiff --git a/spec/components/onebox/engine/whitelisted_generic_onebox_spec.rb b/spec/components/onebox/engine/whitelisted_generic_onebox_spec.rbdeleted file mode 100644index dac0062f128..00000000000--- a/spec/components/onebox/engine/whitelisted_generic_onebox_spec.rb+++ /dev/null@@ -1,49 +0,0 @@-# frozen_string_literal: true--require 'rails_helper'-require 'oneboxer'--describe Onebox::Engine::WhitelistedGenericOnebox do-- describe ".===" do-- it "matches any domain" do- expect(described_class === URI('http://foo.bar/resource')).to be(true)- end-- it "doesn't match an IP address" do- expect(described_class === URI('http://1.2.3.4/resource')).to be(false)- expect(described_class === URI('http://1.2.3.4:1234/resource')).to be(false)- end-- end-- it "whitelists iframes" do- whitelisted_body = '<html><head><link rel="alternate" type="application/json+oembed" href="https://whitelist.ed/iframes.json" />'- blacklisted_body = '<html><head><link rel="alternate" type="application/json+oembed" href="https://blacklist.ed/iframes.json" />'-- whitelisted_oembed = {- type: "rich",- height: "100",- html: "<iframe src='https://ifram.es/foo/bar'></iframe>"- }-- blacklisted_oembed = {- type: "rich",- height: "100",- html: "<iframe src='https://malicious/discourse.org/'></iframe>"- }-- stub_request(:get, "https://blacklist.ed/iframes").to_return(status: 200, body: blacklisted_body)- stub_request(:get, "https://blacklist.ed/iframes.json").to_return(status: 200, body: blacklisted_oembed.to_json)-- stub_request(:get, "https://whitelist.ed/iframes").to_return(status: 200, body: whitelisted_body)- stub_request(:get, "https://whitelist.ed/iframes.json").to_return(status: 200, body: whitelisted_oembed.to_json)-- SiteSetting.allowed_iframes = "discourse.org|https://ifram.es"-- expect(Onebox.preview("https://blacklist.ed/iframes").to_s).to be_empty- expect(Onebox.preview("https://whitelist.ed/iframes").to_s).to match("iframe src")- end--enddiff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rbindex f1681e5bc2b..17843e2a9d3 100644--- a/spec/components/oneboxer_spec.rb+++ b/spec/components/oneboxer_spec.rb@@ -155,8 +155,8 @@ describe Oneboxer doendend- it "does not crawl blacklisted URLs" do- SiteSetting.onebox_domains_blacklist = "git.*.com|bitbucket.com"+ it "does not crawl blocklisted URLs" do+ SiteSetting.blocked_onebox_domains = "git.*.com|bitbucket.com"url = 'https://github.com/discourse/discourse/commit/21b562852885f883be43032e03c709241e8e6d4f'stub_request(:head, 'https://discourse.org/').to_return(status: 302, body: "", headers: { location: url })@@ -164,7 +164,7 @@ describe Oneboxer doexpect(Oneboxer.external_onebox('https://discourse.org/')[:onebox]).to be_emptyend- it "does not consider ignore_redirects domains as blacklisted" do+ it "does not consider ignore_redirects domains as blocklisted" dourl = 'https://store.steampowered.com/app/271590/Grand_Theft_Auto_V/'stub_request(:head, url).to_return(status: 200, body: "", headers: {})stub_request(:get, url).to_return(status: 200, body: "", headers: {})diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rbindex 823fb8900c2..073957026b7 100644--- a/spec/components/pretty_text_spec.rb+++ b/spec/components/pretty_text_spec.rb@@ -762,7 +762,7 @@ describe PrettyText docontext 'option to preserve onebox source' doit "should return the right excerpt" do- onebox = "<aside class=\"onebox whitelistedgeneric\">\n <header class=\"source\">\n <a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">meta.discourse.org</a>\n </header>\n <article class=\"onebox-body\">\n <img src=\"https://cdn-enterprise.discourse.org/meta/user_avatar/meta.discourse.org/gerhard/200/70381_1.png\" width=\"\" height=\"\" class=\"thumbnail\">\n\n<h3><a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">Infrequent translation updates in stable branch</a></h3>\n\n<p>Well, there's an Italian translation for \"New Topic\" in beta, it's been there since November 2014 and it works here on meta. Do you have any plugins installed? Try disabling them. I'm quite confident that it's either a plugin or a site...</p>\n\n </article>\n <div class=\"onebox-metadata\">\n \n \n </div>\n <div style=\"clear: both\"></div>\n</aside>\n\n\n"+ onebox = "<aside class=\"onebox allowlistedgeneric\">\n <header class=\"source\">\n <a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">meta.discourse.org</a>\n </header>\n <article class=\"onebox-body\">\n <img src=\"https://cdn-enterprise.discourse.org/meta/user_avatar/meta.discourse.org/gerhard/200/70381_1.png\" width=\"\" height=\"\" class=\"thumbnail\">\n\n<h3><a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">Infrequent translation updates in stable branch</a></h3>\n\n<p>Well, there's an Italian translation for \"New Topic\" in beta, it's been there since November 2014 and it works here on meta. Do you have any plugins installed? Try disabling them. I'm quite confident that it's either a plugin or a site...</p>\n\n </article>\n <div class=\"onebox-metadata\">\n \n \n </div>\n <div style=\"clear: both\"></div>\n</aside>\n\n\n"expected = "<a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">meta.discourse.org</a>"expect(PrettyText.excerpt(onebox, 100, keep_onebox_source: true))@@ -1554,7 +1554,7 @@ HTMLend- it "can properly whitelist iframes" do+ it "can properly allowlist iframes" doSiteSetting.allowed_iframes = "https://bob.com/a|http://silly.com?EMBED="raw = <<~IFRAMES<iframe src='https://www.google.com/maps/Embed?testing'></iframe>@@ -1619,12 +1619,12 @@ HTMLexpect(cooked).to include("data-theme-a")end- it "whitelists lang attribute" do+ it "allowlists lang attribute" docooked = PrettyText.cook("<p lang='fr'>tester</p><div lang='fr'>tester</div><span lang='fr'>tester</span>")expect(cooked).to eq("<p lang=\"fr\">tester</p><div lang=\"fr\">tester</div><span lang=\"fr\">tester</span>")end- it "whitelists ruby tags" do+ it "allowlists ruby tags" do# read all about ruby chars at: https://en.wikipedia.org/wiki/Ruby_character# basically it is super hard to remember every single rare letter when there are# so many, so ruby tags provide a hint.diff --git a/spec/components/site_setting_extension_spec.rb b/spec/components/site_setting_extension_spec.rbindex ee856e144c0..a366db09571 100644--- a/spec/components/site_setting_extension_spec.rb+++ b/spec/components/site_setting_extension_spec.rb@@ -595,18 +595,18 @@ describe SiteSettingExtension dodescribe "filter domain name" dobefore do- settings.setting(:white_listed_spam_host_domains, "www.example.com")+ settings.setting(:allowed_spam_host_domains, "www.example.com")settings.refresh!endit "filters domain" do- settings.set("white_listed_spam_host_domains", "http://www.discourse.org/")- expect(settings.white_listed_spam_host_domains).to eq("www.discourse.org")+ settings.set("allowed_spam_host_domains", "http://www.discourse.org/")+ expect(settings.allowed_spam_host_domains).to eq("www.discourse.org")endit "returns invalid domain as is, without throwing exception" do- settings.set("white_listed_spam_host_domains", "test!url")- expect(settings.white_listed_spam_host_domains).to eq("test!url")+ settings.set("allowed_spam_host_domains", "test!url")+ expect(settings.allowed_spam_host_domains).to eq("test!url")endenddiff --git a/spec/components/spam_handler_spec.rb b/spec/components/spam_handler_spec.rbindex f4216854d2f..310c4a17929 100644--- a/spec/components/spam_handler_spec.rb+++ b/spec/components/spam_handler_spec.rb@@ -48,11 +48,11 @@ describe SpamHandler doFabricate(:user, ip_address: "42.42.42.42", trust_level: TrustLevel[0])end- it "doesn't limit registrations when the IP is whitelisted" do+ it "doesn't limit registrations when the IP is allowlisted" do# setupSiteSetting.max_new_accounts_per_registration_ip = 0Fabricate(:user, ip_address: "42.42.42.42", trust_level: TrustLevel[0])- ScreenedIpAddress.stubs(:is_whitelisted?).with("42.42.42.42").returns(true)+ ScreenedIpAddress.stubs(:is_allowed?).with("42.42.42.42").returns(true)# should not limit registrationSiteSetting.max_new_accounts_per_registration_ip = 1diff --git a/spec/components/user_name_suggester_spec.rb b/spec/components/user_name_suggester_spec.rbindex a7e9b19fab5..ed1673b66bf 100644--- a/spec/components/user_name_suggester_spec.rb+++ b/spec/components/user_name_suggester_spec.rb@@ -171,14 +171,14 @@ describe UserNameSuggester do.to eq('য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া-য়া')end- it "uses whitelist" do- SiteSetting.unicode_username_character_whitelist = "[äöüßÄÖÜẞ]"+ it "uses allowlist" do+ SiteSetting.allowed_unicode_username_characters = "[äöüßÄÖÜẞ]"expect(UserNameSuggester.suggest('πουλί')).to eq('111')expect(UserNameSuggester.suggest('a鳥b')).to eq('a_b')expect(UserNameSuggester.suggest('Löwe')).to eq('Löwe')- SiteSetting.unicode_username_character_whitelist = "[য়া]"+ SiteSetting.allowed_unicode_username_characters = "[য়া]"expect(UserNameSuggester.suggest('aয়াb鳥c')).to eq('aয়াb_c')endenddiff --git a/spec/components/validators/email_validator_spec.rb b/spec/components/validators/email_validator_spec.rbindex 41c29e1b511..0290c7c99c7 100644--- a/spec/components/validators/email_validator_spec.rb+++ b/spec/components/validators/email_validator_spec.rb@@ -21,8 +21,8 @@ describe EmailValidator doexpect(blocks?('[email protected]')).to eq(true)end- it "blocks based on email_domains_blacklist" do- SiteSetting.email_domains_blacklist = "email.com|mail.com|e-mail.com"+ it "blocks based on blocked_email_domains" do+ SiteSetting.blocked_email_domains = "email.com|mail.com|e-mail.com"expect(blocks?('[email protected]')).to eq(true)expect(blocks?('[email protected]')).to eq(true)expect(blocks?('[email protected]')).to eq(true)@@ -30,8 +30,8 @@ describe EmailValidator doexpect(blocks?('[email protected]')).to eq(false)end- it "blocks based on email_domains_whitelist" do- SiteSetting.email_domains_whitelist = "googlemail.com|email.com"+ it "blocks based on allowed_email_domains" do+ SiteSetting.allowed_email_domains = "googlemail.com|email.com"expect(blocks?('[email protected]')).to eq(false)expect(blocks?('[email protected]')).to eq(false)expect(blocks?('[email protected]')).to eq(false)@@ -49,8 +49,8 @@ describe EmailValidator doexpect(EmailValidator.can_auto_approve_user?("[email protected]")).to eq(true)end- it "returns false if domain not present in email_domains_whitelist" do- SiteSetting.email_domains_whitelist = "googlemail.com"+ it "returns false if domain not present in allowed_email_domains" do+ SiteSetting.allowed_email_domains = "googlemail.com"SiteSetting.auto_approve_email_domains = "example.com|googlemail.com"expect(EmailValidator.can_auto_approve_user?("[email protected]")).to eq(false)diff --git a/spec/components/validators/unicode_username_whitelist_validator_spec.rb b/spec/components/validators/unicode_username_allowlist_validator_spec.rbsimilarity index 76%rename from spec/components/validators/unicode_username_whitelist_validator_spec.rbrename to spec/components/validators/unicode_username_allowlist_validator_spec.rbindex 0deb2da8e9c..dff71443ff6 100644--- a/spec/components/validators/unicode_username_whitelist_validator_spec.rb+++ b/spec/components/validators/unicode_username_allowlist_validator_spec.rb@@ -2,16 +2,16 @@require 'rails_helper'-describe UnicodeUsernameWhitelistValidator do+describe UnicodeUsernameAllowlistValidator dosubject { described_class.new }- it "allows an empty whitelist" do+ it "allows an empty allowlist" doexpect(subject.valid_value?("")).to eq(true)expect(subject.error_message).to be_blankendit "disallows leading and trailing slashes" do- expected_error = I18n.t("site_settings.errors.unicode_username_whitelist.leading_trailing_slash")+ expected_error = I18n.t("site_settings.errors.allowed_unicode_usernames.leading_trailing_slash")expect(subject.valid_value?("/foo/")).to eq(false)expect(subject.error_message).to eq(expected_error)@@ -30,7 +30,7 @@ describe UnicodeUsernameWhitelistValidator doendit "detects invalid regular expressions" do- expected_error = I18n.t("site_settings.errors.unicode_username_whitelist.regex_invalid", error: "")+ expected_error = I18n.t("site_settings.errors.allowed_unicode_usernames.regex_invalid", error: "")expect(subject.valid_value?("\\p{Foo}")).to eq(false)expect(subject.error_message).to start_with(expected_error)diff --git a/spec/fixtures/emails/auto_generated_whitelisted.eml b/spec/fixtures/emails/auto_generated_allowlisted.emlsimilarity index 100%rename from spec/fixtures/emails/auto_generated_whitelisted.emlrename to spec/fixtures/emails/auto_generated_allowlisted.emldiff --git a/spec/fixtures/emails/blacklist_whitelist_email.eml b/spec/fixtures/emails/blocklist_allowlist_email.emlsimilarity index 85%rename from spec/fixtures/emails/blacklist_whitelist_email.emlrename to spec/fixtures/emails/blocklist_allowlist_email.emlindex f9b0adf7905..7ffe3674ac0 100644--- a/spec/fixtures/emails/blacklist_whitelist_email.eml+++ b/spec/fixtures/emails/blocklist_allowlist_email.eml@@ -8,4 +8,4 @@ Mime-Version: 1.0Content-Type: text/plainContent-Transfer-Encoding: 7bit-Email from a domain on blacklist or whitelist.+Email from a domain on blocklist or allowlist.diff --git a/spec/lib/content_security_policy_spec.rb b/spec/lib/content_security_policy_spec.rbindex 4196b29d669..bad12dd2c31 100644--- a/spec/lib/content_security_policy_spec.rb+++ b/spec/lib/content_security_policy_spec.rb@@ -66,7 +66,7 @@ describe ContentSecurityPolicy doexpect(script_srcs).to include("'report-sample'")end- it 'whitelists Google Analytics and Tag Manager when integrated' do+ it 'allowlists Google Analytics and Tag Manager when integrated' doSiteSetting.ga_universal_tracking_code = 'UA-12345678-9'SiteSetting.gtm_container_id = 'GTM-ABCDEF'@@ -75,7 +75,7 @@ describe ContentSecurityPolicy doexpect(script_srcs).to include('https://www.googletagmanager.com/gtm.js')end- it 'whitelists CDN assets when integrated' do+ it 'allowlists CDN assets when integrated' doset_cdn_url('https://cdn.com')script_srcs = parse(policy)['script-src']diff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rbindex 91a431565cb..6ca63b7e3c6 100644--- a/spec/lib/upload_creator_spec.rb+++ b/spec/lib/upload_creator_spec.rb@@ -402,7 +402,7 @@ RSpec.describe UploadCreator doendend- describe '#whitelist_svg!' do+ describe '#clean_svg!' dolet(:b64) doBase64.encode64('<svg onmouseover="alert(alert)" />')end@@ -428,7 +428,7 @@ RSpec.describe UploadCreator doit 'removes event handlers' dobegin- UploadCreator.new(file, 'file.svg').whitelist_svg!+ UploadCreator.new(file, 'file.svg').clean_svg!file_content = file.readexpect(file_content).not_to include('onload')expect(file_content).to include('#pathdef')diff --git a/spec/models/embeddable_host_spec.rb b/spec/models/embeddable_host_spec.rbindex 66b81b9bd45..2a76688553c 100644--- a/spec/models/embeddable_host_spec.rb+++ b/spec/models/embeddable_host_spec.rb@@ -96,37 +96,37 @@ describe EmbeddableHost doendend- describe "path_whitelist" do+ describe "allowed_paths" doit "matches the path" do- Fabricate(:embeddable_host, path_whitelist: '^/fp/\d{4}/\d{2}/\d{2}/.*$')+ Fabricate(:embeddable_host, allowed_paths: '^/fp/\d{4}/\d{2}/\d{2}/.*$')expect(EmbeddableHost.url_allowed?('http://eviltrout.com')).to eq(false)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/fp/2016/08/25/test-page')).to eq(true)endit "respects query parameters" do- Fabricate(:embeddable_host, path_whitelist: '^/fp$')+ Fabricate(:embeddable_host, allowed_paths: '^/fp$')expect(EmbeddableHost.url_allowed?('http://eviltrout.com/fp?test=1')).to eq(false)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/fp')).to eq(true)endit "allows multiple records with different paths" do- Fabricate(:embeddable_host, path_whitelist: '/rick/.*')- Fabricate(:embeddable_host, path_whitelist: '/morty/.*')+ Fabricate(:embeddable_host, allowed_paths: '/rick/.*')+ Fabricate(:embeddable_host, allowed_paths: '/morty/.*')expect(EmbeddableHost.url_allowed?('http://eviltrout.com/rick/smith')).to eq(true)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/morty/sanchez')).to eq(true)endit "works with non-english paths" do- Fabricate(:embeddable_host, path_whitelist: '/انگلیسی/.*')- Fabricate(:embeddable_host, path_whitelist: '/definição/.*')+ Fabricate(:embeddable_host, allowed_paths: '/انگلیسی/.*')+ Fabricate(:embeddable_host, allowed_paths: '/definição/.*')expect(EmbeddableHost.url_allowed?('http://eviltrout.com/انگلیسی/foo')).to eq(true)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/definição/foo')).to eq(true)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/bar/foo')).to eq(false)endit "works with URL encoded paths" do- Fabricate(:embeddable_host, path_whitelist: '/definição/.*')- Fabricate(:embeddable_host, path_whitelist: '/ingl%C3%A9s/.*')+ Fabricate(:embeddable_host, allowed_paths: '/definição/.*')+ Fabricate(:embeddable_host, allowed_paths: '/ingl%C3%A9s/.*')expect(EmbeddableHost.url_allowed?('http://eviltrout.com/defini%C3%A7%C3%A3o/foo')).to eq(true)expect(EmbeddableHost.url_allowed?('http://eviltrout.com/inglés/foo')).to eq(true)diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rbindex 9bc3e33ff94..fc81d4d8d3f 100644--- a/spec/models/invite_spec.rb+++ b/spec/models/invite_spec.rb@@ -33,12 +33,12 @@ describe Invite doexpect(invite.errors.details[:email].first[:error]).to eq(I18n.t("user.email.invalid"))end- it "should not allow an invite with blacklisted email" do+ it "should not allow an invite with blocklisted email" doinvite = Invite.create(email: "[email protected]", invited_by: coding_horror)expect(invite).not_to be_validend- it "should allow an invite with non-blacklisted email" do+ it "should allow an invite with non-blocklisted email" doinvite = Fabricate(:invite, email: "[email protected]", invited_by: coding_horror)expect(invite).to be_validenddiff --git a/spec/models/post_analyzer_spec.rb b/spec/models/post_analyzer_spec.rbindex 70addd30cd2..f0dd58d814f 100644--- a/spec/models/post_analyzer_spec.rb+++ b/spec/models/post_analyzer_spec.rb@@ -156,8 +156,8 @@ describe PostAnalyzer doexpect(post_analyzer.image_count).to eq(0)end- it "doesn't count whitelisted images" do- Post.stubs(:white_listed_image_classes).returns(["classy"])+ it "doesn't count allowlisted images" do+ Post.stubs(:allowed_image_classes).returns(["classy"])PrettyText.stubs(:cook).returns(raw_post_with_two_classy_images)post_analyzer = PostAnalyzer.new(raw_post_with_two_classy_images, default_topic_id)expect(post_analyzer.image_count).to eq(0)diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rbindex 24c89305dd1..559b1ff06e8 100644--- a/spec/models/post_spec.rb+++ b/spec/models/post_spec.rb@@ -310,9 +310,9 @@ describe Post doexpect(post_with_thumbnail.image_count).to eq(0)end- it "doesn't count whitelisted images" do- Post.stubs(:white_listed_image_classes).returns(["classy"])- # I dislike this, but passing in a custom whitelist is hard+ it "doesn't count allowlisted images" do+ Post.stubs(:allowed_image_classes).returns(["classy"])+ # I dislike this, but passing in a custom allowlist is hardPrettyText.stubs(:cook).returns(post_with_two_classy_images.raw)expect(post_with_two_classy_images.image_count).to eq(0)end@@ -527,8 +527,8 @@ describe Post doexpect(post_one_link).not_to be_validend- it "will skip the check for whitelisted domains" do- SiteSetting.whitelisted_link_domains = 'www.bbc.co.uk'+ it "will skip the check for allowlisted domains" do+ SiteSetting.allowed_link_domains = 'www.bbc.co.uk'SiteSetting.min_trust_to_post_links = 2post_two_links.user.trust_level = TrustLevel[1]expect(post_one_link).to be_valid@@ -1107,7 +1107,7 @@ describe Post doexpect(post.has_host_spam?).to eq(true)- SiteSetting.white_listed_spam_host_domains = "bla.com|boo.com | example.net "+ SiteSetting.allowed_spam_host_domains = "bla.com|boo.com | example.net "expect(post.has_host_spam?).to eq(false)enddiff --git a/spec/models/screened_ip_address_spec.rb b/spec/models/screened_ip_address_spec.rbindex 84876a122ff..5c069135fb5 100644--- a/spec/models/screened_ip_address_spec.rb+++ b/spec/models/screened_ip_address_spec.rb@@ -212,37 +212,37 @@ describe ScreenedIpAddress doendend- describe '#is_whitelisted?' do+ describe '#is_allowed?' doit 'returns false when record does not exist' do- expect(described_class.is_whitelisted?(ip_address)).to eq(false)+ expect(described_class.is_allowed?(ip_address)).to eq(false)endit 'returns false when no record matches' doFabricate(:screened_ip_address, ip_address: '111.234.23.11', action_type: described_class.actions[:do_nothing])- expect(described_class.is_whitelisted?('222.12.12.12')).to eq(false)+ expect(described_class.is_allowed?('222.12.12.12')).to eq(false)endcontext 'IPv4' doit 'returns true when when record matches and action is :do_nothing' doFabricate(:screened_ip_address, ip_address: '111.234.23.11', action_type: described_class.actions[:do_nothing])- expect(described_class.is_whitelisted?('111.234.23.11')).to eq(true)+ expect(described_class.is_allowed?('111.234.23.11')).to eq(true)endit 'returns false when when record matches and action is :block' doFabricate(:screened_ip_address, ip_address: '111.234.23.11', action_type: described_class.actions[:block])- expect(described_class.is_whitelisted?('111.234.23.11')).to eq(false)+ expect(described_class.is_allowed?('111.234.23.11')).to eq(false)endendcontext 'IPv6' doit 'returns true when when record matches and action is :do_nothing' doFabricate(:screened_ip_address, ip_address: '2001:db8::ff00:42:8329', action_type: described_class.actions[:do_nothing])- expect(described_class.is_whitelisted?('2001:db8::ff00:42:8329')).to eq(true)+ expect(described_class.is_allowed?('2001:db8::ff00:42:8329')).to eq(true)endit 'returns false when when record matches and action is :block' doFabricate(:screened_ip_address, ip_address: '2001:db8::ff00:42:8329', action_type: described_class.actions[:block])- expect(described_class.is_whitelisted?('2001:db8::ff00:42:8329')).to eq(false)+ expect(described_class.is_allowed?('2001:db8::ff00:42:8329')).to eq(false)endendend@@ -250,12 +250,12 @@ describe ScreenedIpAddress dodescribe '#block_admin_login?' docontext 'no allow_admin records exist' do- it "returns false when use_admin_ip_whitelist is false" do+ it "returns false when use_admin_ip_allowlist is false" doexpect(described_class.block_admin_login?(Fabricate.build(:user), '123.12.12.12')).to eq(false)end- context "use_admin_ip_whitelist is true" do- before { SiteSetting.use_admin_ip_whitelist = true }+ context "use_admin_ip_allowlist is true" do+ before { SiteSetting.use_admin_ip_allowlist = true }it "returns false when user is nil" doexpect(described_class.block_admin_login?(nil, '123.12.12.12')).to eq(false)@@ -281,12 +281,12 @@ describe ScreenedIpAddress doFabricate(:screened_ip_address, ip_address: @permitted_ip_address, action_type: described_class.actions[:allow_admin])end- it "returns false when use_admin_ip_whitelist is false" do+ it "returns false when use_admin_ip_allowlist is false" doexpect(described_class.block_admin_login?(Fabricate.build(:admin), '123.12.12.12')).to eq(false)end- context "use_admin_ip_whitelist is true" do- before { SiteSetting.use_admin_ip_whitelist = true }+ context "use_admin_ip_allowlist is true" do+ before { SiteSetting.use_admin_ip_allowlist = true }it "returns false when user is nil" doexpect(described_class.block_admin_login?(nil, @permitted_ip_address)).to eq(false)diff --git a/spec/models/site_setting_spec.rb b/spec/models/site_setting_spec.rbindex fc185415451..9b87678b3fd 100644--- a/spec/models/site_setting_spec.rb+++ b/spec/models/site_setting_spec.rb@@ -197,11 +197,11 @@ describe SiteSetting dodescribe 'cached settings' doit 'should recalcualte cached setting when dependent settings are changed' do- SiteSetting.attachment_filename_blacklist = 'foo'- expect(SiteSetting.attachment_filename_blacklist_regex).to eq(/foo/)+ SiteSetting.blocked_attachment_filenames = 'foo'+ expect(SiteSetting.blocked_attachment_filenames_regex).to eq(/foo/)- SiteSetting.attachment_filename_blacklist = 'foo|bar'- expect(SiteSetting.attachment_filename_blacklist_regex).to eq(/foo|bar/)+ SiteSetting.blocked_attachment_filenames = 'foo|bar'+ expect(SiteSetting.blocked_attachment_filenames_regex).to eq(/foo|bar/)endendenddiff --git a/spec/models/topic_embed_spec.rb b/spec/models/topic_embed_spec.rbindex bc061ddcbe4..48df6ce768f 100644--- a/spec/models/topic_embed_spec.rb+++ b/spec/models/topic_embed_spec.rb@@ -192,7 +192,7 @@ describe TopicEmbed doresponse = nilbefore do- SiteSetting.embed_classname_whitelist = 'emoji, foo'+ SiteSetting.allowed_embed_classnames = 'emoji, foo'file.stubs(:read).returns contentsTopicEmbed.stubs(:open).returns filestub_request(:head, url)@@ -252,7 +252,7 @@ describe TopicEmbed doresponse = nilbefore(:each) do- SiteSetting.embed_classname_whitelist = ''+ SiteSetting.allowed_embed_classnames = ''file.stubs(:read).returns contentsTopicEmbed.stubs(:open).returns filestub_request(:head, url)diff --git a/spec/models/topic_link_click_spec.rb b/spec/models/topic_link_click_spec.rbindex 121bb872213..a4d6771db65 100644--- a/spec/models/topic_link_click_spec.rb+++ b/spec/models/topic_link_click_spec.rb@@ -47,7 +47,7 @@ describe TopicLinkClick doclick = TopicLinkClick.create_from(url: "http://url-that-doesnt-exist.com", post_id: @post.id, ip: '127.0.0.1')expect(click).to eq(nil)- # redirects if whitelisted+ # redirects if allowlistedclick = TopicLinkClick.create_from(url: "https://www.youtube.com/watch?v=jYd_5aggzd4", post_id: @post.id, ip: '127.0.0.1')expect(click).to eq("https://www.youtube.com/watch?v=jYd_5aggzd4")diff --git a/spec/models/user_profile_spec.rb b/spec/models/user_profile_spec.rbindex eb1121342ee..65221592b0b 100644--- a/spec/models/user_profile_spec.rb+++ b/spec/models/user_profile_spec.rb@@ -47,8 +47,8 @@ describe UserProfile doexpect(user_profile).to_not be_validend- it "validates website domain if user_website_domains_whitelist setting is present" do- SiteSetting.user_website_domains_whitelist = "discourse.org"+ it "validates website domain if allowed_user_website_domains setting is present" do+ SiteSetting.allowed_user_website_domains = "discourse.org"user_profile.website = "https://google.com"expect(user_profile).not_to be_valid@@ -58,7 +58,7 @@ describe UserProfile doendit "doesn't blow up with an invalid URI" do- SiteSetting.user_website_domains_whitelist = "discourse.org"+ SiteSetting.allowed_user_website_domains = "discourse.org"user_profile.website = 'user - https://forum.example.com/user'expect { user_profile.save! }.to raise_error(ActiveRecord::RecordInvalid)diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rbindex 313d3819900..fbaa52a4931 100644--- a/spec/models/user_spec.rb+++ b/spec/models/user_spec.rb@@ -755,108 +755,108 @@ describe User doexpect(user).to be_validend- it 'should reject some emails based on the email_domains_blacklist site setting' do- SiteSetting.email_domains_blacklist = 'mailinator.com'+ it 'should reject some emails based on the blocked_email_domains site setting' do+ SiteSetting.blocked_email_domains = 'mailinator.com'expect(Fabricate.build(:user, email: '[email protected]')).not_to be_validexpect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'should reject some emails based on the email_domains_blacklist site setting' do- SiteSetting.email_domains_blacklist = 'mailinator.com|trashmail.net'+ it 'should reject some emails based on the blocked_email_domains site setting' do+ SiteSetting.blocked_email_domains = 'mailinator.com|trashmail.net'expect(Fabricate.build(:user, email: '[email protected]')).not_to be_validexpect(Fabricate.build(:user, email: '[email protected]')).not_to be_validexpect(Fabricate.build(:user, email: '[email protected]')).to be_validendit 'should not reject partial matches' do- SiteSetting.email_domains_blacklist = 'mail.com'+ SiteSetting.blocked_email_domains = 'mail.com'expect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'should reject some emails based on the email_domains_blacklist site setting ignoring case' do- SiteSetting.email_domains_blacklist = 'trashmail.net'+ it 'should reject some emails based on the blocked_email_domains site setting ignoring case' do+ SiteSetting.blocked_email_domains = 'trashmail.net'expect(Fabricate.build(:user, email: '[email protected]')).not_to be_validend- it 'should reject emails based on the email_domains_blacklist site setting matching subdomain' do- SiteSetting.email_domains_blacklist = 'domain.com'+ it 'should reject emails based on the blocked_email_domains site setting matching subdomain' do+ SiteSetting.blocked_email_domains = 'domain.com'expect(Fabricate.build(:user, email: '[email protected]')).not_to be_validend- it 'skips the blacklist if skip_email_validation is set' do- SiteSetting.email_domains_blacklist = 'domain.com'+ it 'skips the blocklist if skip_email_validation is set' do+ SiteSetting.blocked_email_domains = 'domain.com'user = Fabricate.build(:user, email: '[email protected]')user.skip_email_validation = trueexpect(user).to be_validend- it 'blacklist should not reject developer emails' do+ it 'blocklist should not reject developer emails' doRails.configuration.stubs(:developer_emails).returns('[email protected]')- SiteSetting.email_domains_blacklist = 'discourse.org'+ SiteSetting.blocked_email_domains = 'discourse.org'expect(Fabricate.build(:user, email: '[email protected]')).to be_validendit 'should not interpret a period as a wildcard' do- SiteSetting.email_domains_blacklist = 'trashmail.net'+ SiteSetting.blocked_email_domains = 'trashmail.net'expect(Fabricate.build(:user, email: '[email protected]')).to be_validendit 'should not be used to validate existing records' do- u = Fabricate(:user, email: '[email protected]')- SiteSetting.email_domains_blacklist = 'fakemail.com'+ u = Fabricate(:user, email: '[email protected]')+ SiteSetting.blocked_email_domains = 'fakemail.com'expect(u).to be_validendit 'should be used when email is being changed' do- SiteSetting.email_domains_blacklist = 'mailinator.com'+ SiteSetting.blocked_email_domains = 'mailinator.com'u = Fabricate(:user, email: '[email protected]')u.email = '[email protected]'expect(u).not_to be_validend- it 'whitelist should reject some emails based on the email_domains_whitelist site setting' do- SiteSetting.email_domains_whitelist = 'vaynermedia.com'+ it 'allowlist should reject some emails based on the allowed_email_domains site setting' do+ SiteSetting.allowed_email_domains = 'vaynermedia.com'user = Fabricate.build(:user, email: '[email protected]')expect(user).not_to be_validexpect(user.errors.messages[:primary_email]).to include(I18n.t('user.email.not_allowed'))expect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'should reject some emails based on the email_domains_whitelist site setting when whitelisting multiple domains' do- SiteSetting.email_domains_whitelist = 'vaynermedia.com|gmail.com'+ it 'should reject some emails based on the allowed_email_domains site setting when allowlisting multiple domains' do+ SiteSetting.allowed_email_domains = 'vaynermedia.com|gmail.com'expect(Fabricate.build(:user, email: '[email protected]')).not_to be_validexpect(Fabricate.build(:user, email: '[email protected]')).not_to be_validexpect(Fabricate.build(:user, email: '[email protected]')).to be_validexpect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'should accept some emails based on the email_domains_whitelist site setting ignoring case' do- SiteSetting.email_domains_whitelist = 'vaynermedia.com'+ it 'should accept some emails based on the allowed_email_domains site setting ignoring case' do+ SiteSetting.allowed_email_domains = 'vaynermedia.com'expect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'whitelist should accept developer emails' do+ it 'allowlist should accept developer emails' doRails.configuration.stubs(:developer_emails).returns('[email protected]')- SiteSetting.email_domains_whitelist = 'awesome.org'+ SiteSetting.allowed_email_domains = 'awesome.org'expect(Fabricate.build(:user, email: '[email protected]')).to be_validend- it 'email whitelist should not be used to validate existing records' do- u = Fabricate(:user, email: '[email protected]')- SiteSetting.email_domains_blacklist = 'vaynermedia.com'+ it 'email allowlist should not be used to validate existing records' do+ u = Fabricate(:user, email: '[email protected]')+ SiteSetting.blocked_email_domains = 'vaynermedia.com'expect(u).to be_validend- it 'email whitelist should be used when email is being changed' do- SiteSetting.email_domains_whitelist = 'vaynermedia.com'+ it 'email allowlist should be used when email is being changed' do+ SiteSetting.allowed_email_domains = 'vaynermedia.com'u = Fabricate(:user, email: '[email protected]')u.email = '[email protected]'expect(u).not_to be_validendit "doesn't validate email address for staged users" do- SiteSetting.email_domains_whitelist = "foo.com"- SiteSetting.email_domains_blacklist = "bar.com"+ SiteSetting.allowed_email_domains = "foo.com"+ SiteSetting.blocked_email_domains = "bar.com"user = Fabricate.build(:user, staged: true, email: "[email protected]")diff --git a/spec/models/username_validator_spec.rb b/spec/models/username_validator_spec.rbindex eb45a229982..5bf51119969 100644--- a/spec/models/username_validator_spec.rb+++ b/spec/models/username_validator_spec.rb@@ -178,27 +178,27 @@ describe UsernameValidator doexpect_valid('தமிழ்')end- it 'allows all Unicode letters when the whitelist is empty' do+ it 'allows all Unicode letters when the allowlist is empty' doexpect_valid('鳥')end- context "with Unicode whitelist" do- before { SiteSetting.unicode_username_character_whitelist = "[äöüÄÖÜß]" }+ context "with Unicode allowlist" do+ before { SiteSetting.allowed_unicode_username_characters = "[äöüÄÖÜß]" }- it 'is invalid when username contains non-whitelisted letters' do+ it 'is invalid when username contains non-allowlisted letters' doexpect_invalid('鳥', 'francès', error_message: I18n.t(:'user.username.characters'))end- it 'is valid when username contains only whitelisted letters' do+ it 'is valid when username contains only allowlisted letters' doexpect_valid('Löwe', 'Ötzi')end- it 'is valid when username contains only ASCII letters and numbers regardless of whitelist' do+ it 'is valid when username contains only ASCII letters and numbers regardless of allowlist' doexpect_valid('a-z_A-Z.0-9')endit 'is valid after resetting the site setting' do- SiteSetting.unicode_username_character_whitelist = ""+ SiteSetting.allowed_unicode_username_characters = ""expect_valid('鳥')endenddiff --git a/spec/requests/admin/themes_controller_spec.rb b/spec/requests/admin/themes_controller_spec.rbindex a7d42ce4f9b..1db8e6ce495 100644--- a/spec/requests/admin/themes_controller_spec.rb+++ b/spec/requests/admin/themes_controller_spec.rb@@ -100,17 +100,17 @@ describe Admin::ThemesController dofile_from_fixtures("logo.png")end- context 'when theme whitelist mode is enabled' do+ context 'when theme allowlist mode is enabled' dobefore do- GlobalSetting.reset_whitelisted_theme_ids!- global_setting :whitelisted_theme_repos, "https://github.com/discourse/discourse-brand-header"+ GlobalSetting.reset_allowed_theme_ids!+ global_setting :allowed_theme_repos, "https://github.com/discourse/discourse-brand-header"endafter do- GlobalSetting.reset_whitelisted_theme_ids!+ GlobalSetting.reset_allowed_theme_ids!end- it "allows whitelisted imports" do+ it "allows allowlisted imports" doRemoteTheme.stubs(:import_theme)post "/admin/themes/import.json", params: {remote: ' https://github.com/discourse/discourse-brand-header '@@ -308,14 +308,14 @@ describe Admin::ThemesController doexpect(SiteSetting.default_theme_id).to eq(-1)end- context 'when theme whitelist mode is enabled' do+ context 'when theme allowlist mode is enabled' dobefore do- GlobalSetting.reset_whitelisted_theme_ids!- global_setting :whitelisted_theme_repos, " https://magic.com/repo.git, https://x.com/git"+ GlobalSetting.reset_allowed_theme_ids!+ global_setting :allowed_theme_repos, " https://magic.com/repo.git, https://x.com/git"endafter do- GlobalSetting.reset_whitelisted_theme_ids!+ GlobalSetting.reset_allowed_theme_ids!endit 'unconditionally bans theme_fields from updating' dodiff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rbindex 6622b42acf6..f2d11f4de6c 100644--- a/spec/requests/posts_controller_spec.rb+++ b/spec/requests/posts_controller_spec.rb@@ -125,7 +125,7 @@ describe PostsController dolet(:url) { "/posts/#{post.id}/reply-history.json" }end- it "returns the replies with whitelisted user custom fields" do+ it "returns the replies with allowlisted user custom fields" doparent = Fabricate(:post)child = Fabricate(:post, topic: parent.topic, reply_to_post_number: parent.post_number)diff --git a/spec/requests/reviewables_controller_spec.rb b/spec/requests/reviewables_controller_spec.rbindex b8364592e6f..28a919b3094 100644--- a/spec/requests/reviewables_controller_spec.rb+++ b/spec/requests/reviewables_controller_spec.rb@@ -196,7 +196,7 @@ describe ReviewablesController docontext "with user custom field" dobefore doplugin = Plugin::Instance.new- plugin.whitelist_public_user_custom_field :public_field+ plugin.allow_public_user_custom_field :public_fieldendafter dodiff --git a/spec/requests/robots_txt_controller_spec.rb b/spec/requests/robots_txt_controller_spec.rbindex 151f9d60ba6..3fed57ccae6 100644--- a/spec/requests/robots_txt_controller_spec.rb+++ b/spec/requests/robots_txt_controller_spec.rb@@ -93,8 +93,8 @@ RSpec.describe RobotsTxtController doexpect(response.body[i..-1]).to include("Disallow: /auth/")end- it "can whitelist user agents" do- SiteSetting.whitelisted_crawler_user_agents = "Googlebot|Twitterbot"+ it "can allowlist user agents" do+ SiteSetting.allowed_crawler_user_agents = "Googlebot|Twitterbot"get '/robots.txt'expect(response.body).to include('User-agent: Googlebot')expect(response.body).to include('User-agent: Twitterbot')@@ -105,8 +105,8 @@ RSpec.describe RobotsTxtController doexpect_allowed_and_disallowed_sections(allowed_index, disallow_all_index)end- it "can blacklist user agents" do- SiteSetting.blacklisted_crawler_user_agents = "Googlebot|Twitterbot"+ it "can blocklist user agents" do+ SiteSetting.blocked_crawler_user_agents = "Googlebot|Twitterbot"get '/robots.txt'expect(response.body).to include('User-agent: Googlebot')expect(response.body).to include('User-agent: Twitterbot')@@ -117,9 +117,9 @@ RSpec.describe RobotsTxtController doexpect_allowed_and_disallowed_sections(allow_index, disallow_index)end- it "ignores blacklist if whitelist is set" do- SiteSetting.whitelisted_crawler_user_agents = "Googlebot|Twitterbot"- SiteSetting.blacklisted_crawler_user_agents = "Bananabot"+ it "ignores blocklist if allowlist is set" do+ SiteSetting.allowed_crawler_user_agents = "Googlebot|Twitterbot"+ SiteSetting.blocked_crawler_user_agents = "Bananabot"get '/robots.txt'expect(response.body).to_not include('Bananabot')expect(response.body).to include('User-agent: Googlebot')diff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rbindex dd44d52970e..a4542c0cc5a 100644--- a/spec/requests/session_controller_spec.rb+++ b/spec/requests/session_controller_spec.rb@@ -212,7 +212,7 @@ RSpec.describe SessionController doaction_type: ScreenedIpAddress.actions[:allow_admin])- SiteSetting.use_admin_ip_whitelist = true+ SiteSetting.use_admin_ip_allowlist = trueuser.update!(admin: true)end@@ -1614,7 +1614,7 @@ RSpec.describe SessionController docontext 'when admins are restricted by ip address' dobefore do- SiteSetting.use_admin_ip_whitelist = true+ SiteSetting.use_admin_ip_allowlist = trueScreenedIpAddress.all.destroy_allenddiff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex b71d3bbbabe..83c0ae9e006 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -679,7 +679,7 @@ RSpec.describe TopicsController doexpect(response.status).to eq(400)end- it 'raises an error with a status not in the whitelist' do+ it 'raises an error with a status not in the allowlist' doput "/t/#{topic.id}/status.json", params: {status: 'title', enabled: 'true'}diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rbindex 629c8f2f55e..77c8b404734 100644--- a/spec/requests/users_controller_spec.rb+++ b/spec/requests/users_controller_spec.rb@@ -2982,9 +2982,9 @@ describe UsersController doexpect(response.status).to eq(422)end- it "raises an error when the email is blacklisted" do+ it "raises an error when the email is blocklisted" dopost_user- SiteSetting.email_domains_blacklist = 'example.com'+ SiteSetting.blocked_email_domains = 'example.com'put "/u/update-activation-email.json", params: { email: '[email protected]' }expect(response.status).to eq(422)enddiff --git a/spec/requests/users_email_controller_spec.rb b/spec/requests/users_email_controller_spec.rbindex 06cc9ced98c..936a9a93fec 100644--- a/spec/requests/users_email_controller_spec.rb+++ b/spec/requests/users_email_controller_spec.rb@@ -371,8 +371,8 @@ describe UsersEmailController doendend- it 'raises an error when new email domain is present in email_domains_blacklist site setting' do- SiteSetting.email_domains_blacklist = "mailinator.com"+ it 'raises an error when new email domain is present in blocked_email_domains site setting' do+ SiteSetting.blocked_email_domains = "mailinator.com"put "/u/#{user.username}/preferences/email.json", params: {email: "[email protected]"@@ -381,8 +381,8 @@ describe UsersEmailController doexpect(response).to_not be_successfulend- it 'raises an error when new email domain is not present in email_domains_whitelist site setting' do- SiteSetting.email_domains_whitelist = "discourse.org"+ it 'raises an error when new email domain is not present in allowed_email_domains site setting' do+ SiteSetting.allowed_email_domains = "discourse.org"put "/u/#{user.username}/preferences/email.json", params: {email: new_emaildiff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rbindex 197adb9f9e7..42a1e1b725d 100644--- a/spec/serializers/user_serializer_spec.rb+++ b/spec/serializers/user_serializer_spec.rb@@ -259,7 +259,7 @@ describe UserSerializer docontext "with user custom field" dobefore doplugin = Plugin::Instance.new- plugin.whitelist_public_user_custom_field :public_field+ plugin.allow_public_user_custom_field :public_fieldendafter dodiff --git a/spec/services/anonymous_shadow_creator_spec.rb b/spec/services/anonymous_shadow_creator_spec.rbindex cb5fcb4abd7..cca0fe66975 100644--- a/spec/services/anonymous_shadow_creator_spec.rb+++ b/spec/services/anonymous_shadow_creator_spec.rb@@ -73,8 +73,8 @@ describe AnonymousShadowCreator doexpect { AnonymousShadowCreator.get(user) }.to_not raise_errorend- it "works when there is an email whitelist" do- SiteSetting.email_domains_whitelist = "wayne.com"+ it "works when there is an email allowlist" do+ SiteSetting.allowed_email_domains = "wayne.com"expect { AnonymousShadowCreator.get(user) }.to_not raise_errorenddiff --git a/spec/services/flag_sockpuppets_spec.rb b/spec/services/flag_sockpuppets_spec.rbindex cebb398a215..4483416350f 100644--- a/spec/services/flag_sockpuppets_spec.rb+++ b/spec/services/flag_sockpuppets_spec.rb@@ -50,8 +50,8 @@ describe SpamRule::FlagSockpuppets doexpect(described_class.new(post2).reply_is_from_sockpuppet?).to eq(true)end- it 'is false if the ip address is whitelisted' do- ScreenedIpAddress.stubs(:is_whitelisted?).with(user1.ip_address).returns(true)+ it 'is false if the ip address is allowlisted' do+ ScreenedIpAddress.stubs(:is_allowed?).with(user1.ip_address).returns(true)post2 = Fabricate(:post, user: Fabricate(:user, ip_address: user1.ip_address), topic: post1.topic)expect(described_class.new(post2).reply_is_from_sockpuppet?).to eq(false)enddiff --git a/spec/services/user_anonymizer_spec.rb b/spec/services/user_anonymizer_spec.rbindex da61af7b222..71d0d2f3360 100644--- a/spec/services/user_anonymizer_spec.rb+++ b/spec/services/user_anonymizer_spec.rb@@ -39,8 +39,8 @@ describe UserAnonymizer doexpect(user.reload.email).to eq("#{user.username}@anonymized.invalid")end- it "changes the primary email address when there is an email domain whitelist" do- SiteSetting.email_domains_whitelist = 'example.net|wayne.com|discourse.org'+ it "changes the primary email address when there is an email domain allowlist" do+ SiteSetting.allowed_email_domains = 'example.net|wayne.com|discourse.org'make_anonymousexpect(user.reload.email).to eq("#{user.username}@anonymized.invalid")diff --git a/spec/services/user_merger_spec.rb b/spec/services/user_merger_spec.rbindex f8f66c99b8b..b7a8aef5071 100644--- a/spec/services/user_merger_spec.rb+++ b/spec/services/user_merger_spec.rb@@ -991,7 +991,7 @@ describe UserMerger doendit "works even when email domains are restricted" do- SiteSetting.email_domains_whitelist = "example.com|work.com"+ SiteSetting.allowed_email_domains = "example.com|work.com"source_user.update_attribute(:admin, true)expect(User.find_by_username(source_user.username)).to be_presentdiff --git a/test/javascripts/controllers/history-test.js b/test/javascripts/controllers/history-test.jsindex 0d8788239dc..6767e810234 100644--- a/test/javascripts/controllers/history-test.js+++ b/test/javascripts/controllers/history-test.js@@ -40,7 +40,7 @@ QUnit.test("displayEdit", async function(assert) {const html = `<div class="revision-content"><p><img src="/uploads/default/original/1X/6b963ffc13cb0c053bbb90c92e99d4fe71b286ef.jpg" alt="" class="diff-del"><img/src=x onerror=alert(document.domain)>" width="276" height="183"></p></div>-<aside class="onebox whitelistedgeneric">+<aside class="onebox allowlistedgeneric"><header class="source"><img src="/uploads/default/original/1X/1b0984d7ee08bce90572f46a1950e1ced436d028.png" class="site-icon" width="32" height="32"><a href="https://meta.discourse.org/t/discourse-version-2-5/125302">Discourse Meta – 9 Aug 19</a>@@ -69,7 +69,7 @@ QUnit.test("displayEdit", async function(assert) {const expectedOutput = `<div class="revision-content"><p><img src="/uploads/default/original/1X/6b963ffc13cb0c053bbb90c92e99d4fe71b286ef.jpg" alt class="diff-del">" width="276" height="183"></p></div>-<aside class="onebox whitelistedgeneric">+<aside class="onebox allowlistedgeneric"><header class="source"><img src="/uploads/default/original/1X/1b0984d7ee08bce90572f46a1950e1ced436d028.png" class="site-icon" width="32" height="32"><a href="https://meta.discourse.org/t/discourse-version-2-5/125302">Discourse Meta – 9 Aug 19</a>diff --git a/test/javascripts/fixtures/topic.js b/test/javascripts/fixtures/topic.jsindex 0ac5183aa04..e4917aab24e 100644--- a/test/javascripts/fixtures/topic.js+++ b/test/javascripts/fixtures/topic.js@@ -3534,9 +3534,9 @@ export default {},{id: 26628,- title: "Embed blacklist selector is broken",- fancy_title: "Embed blacklist selector is broken",- slug: "embed-blacklist-selector-is-broken",+ title: "Embed blocklist selector is broken",+ fancy_title: "Embed blocklist selector is broken",+ slug: "embed-blocklist-selector-is-broken",posts_count: 11,reply_count: 7,highest_post_number: 11,diff --git a/test/javascripts/helpers/create-pretender.js b/test/javascripts/helpers/create-pretender.jsindex 3376b06c4a2..682c27cbe7d 100644--- a/test/javascripts/helpers/create-pretender.js+++ b/test/javascripts/helpers/create-pretender.js@@ -810,7 +810,7 @@ export function applyDefaultHandlers(pretender) {200,{ "Content-Type": "application/html" },`- <aside class="onebox whitelistedgeneric">+ <aside class="onebox allowlistedgeneric"><header class="source"><a href="http://test.com/somepage" target="_blank">test.com</a></header>diff --git a/test/javascripts/lib/oneboxer-test.js b/test/javascripts/lib/oneboxer-test.jsindex 8fe25caeb15..1572a0476ef 100644--- a/test/javascripts/lib/oneboxer-test.js+++ b/test/javascripts/lib/oneboxer-test.js@@ -36,7 +36,7 @@ QUnit.test("load - failed onebox", async assert => {QUnit.test("load - successful onebox", async assert => {const html = `- <aside class="onebox whitelistedgeneric">+ <aside class="onebox allowlistedgeneric"><header class="source"><a href="http://test.com/somepage" target="_blank">test.com</a></header>diff --git a/test/javascripts/lib/pretty-text-test.js b/test/javascripts/lib/pretty-text-test.jsindex e02e8c7e630..9620b0d27d3 100644--- a/test/javascripts/lib/pretty-text-test.js+++ b/test/javascripts/lib/pretty-text-test.js@@ -893,7 +893,7 @@ QUnit.test("Code Blocks", assert => {assert.cooked("```eviltrout\nhello\n```",'<pre><code class="lang-auto">hello\n</code></pre>',- "it doesn't not whitelist all classes"+ "it doesn't not allowlist all classes");assert.cooked(