Bug 1571734 - Call allow lists "allowlists" consistently in Telemetry r=janerik,Dexter
authorChris H-C <chutten@mozilla.com>
Wed, 14 Aug 2019 14:27:49 +0000
changeset 488223 5d3a4cd34a0fd2315005bde171868234d060eb2f
parent 488222 bd8ef39cfadc0e427b1261ae8b2b2f7677d85bd2
child 488224 a055218ae4e272e918c1126082744be928bfb721
push id36437
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:33:18 +0000
treeherdermozilla-central@44aac6fc3352 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanerik, Dexter
bugs1571734
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1571734 - Call allow lists "allowlists" consistently in Telemetry r=janerik,Dexter Differential Revision: https://phabricator.services.mozilla.com/D41432
toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py
toolkit/components/telemetry/core/Telemetry.cpp
toolkit/components/telemetry/docs/collection/hybrid-content.rst
toolkit/components/telemetry/histogram-allowlists.json
toolkit/components/telemetry/histogram-whitelists.json
toolkit/components/telemetry/other/TelemetryIOInterposeObserver.h
toolkit/components/telemetry/tests/browser/browser_HybridContentTelemetry.js
toolkit/components/telemetry/tests/python/test_histogramtools_strict.py
toolkit/components/telemetry/tests/python/test_usecounters.py
--- a/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py
+++ b/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py
@@ -86,39 +86,39 @@ def exponential_buckets(dmin, dmax, n_bu
         if next_value > current:
             current = next_value
         else:
             current = current + 1
         ret_array[bucket_index] = current
     return ret_array
 
 
-whitelists = None
+allowlists = None
 
 
-def load_whitelist():
-    global whitelists
+def load_allowlist():
+    global allowlists
     try:
         parsers_path = os.path.realpath(os.path.dirname(__file__))
         # The parsers live in build_scripts/parsers in the Telemetry module, while
-        # the histogram-whitelists file lives in the root of the module. Account
-        # for that when looking for the whitelist.
+        # the histogram-allowlists file lives in the root of the module. Account
+        # for that when looking for the allowlist.
         # NOTE: if the parsers are moved, this logic will need to be updated.
         telemetry_module_path = os.path.abspath(os.path.join(parsers_path, os.pardir, os.pardir))
-        whitelist_path = os.path.join(telemetry_module_path, 'histogram-whitelists.json')
-        with open(whitelist_path, 'r') as f:
+        allowlist_path = os.path.join(telemetry_module_path, 'histogram-allowlists.json')
+        with open(allowlist_path, 'r') as f:
             try:
-                whitelists = json.load(f)
-                for name, whitelist in whitelists.iteritems():
-                    whitelists[name] = set(whitelist)
+                allowlists = json.load(f)
+                for name, allowlist in allowlists.iteritems():
+                    allowlists[name] = set(allowlist)
             except ValueError:
-                ParserError('Error parsing whitelist: %s' % whitelist_path).handle_now()
+                ParserError('Error parsing allowlist: %s' % allowlist_path).handle_now()
     except IOError:
-        whitelists = None
-        ParserError('Unable to parse whitelist: %s.' % whitelist_path).handle_now()
+        allowlists = None
+        ParserError('Unable to parse allowlist: %s.' % allowlist_path).handle_now()
 
 
 class Histogram:
     """A class for representing a histogram definition."""
 
     def __init__(self, name, definition, strict_type_checks=False):
         """Initialize a histogram named name with the given definition.
 definition is a dict-like object that must contain at least the keys:
@@ -299,18 +299,18 @@ the histogram."""
         if kind not in table:
             ParserError('Unknown kind "%s" for histogram "%s".' % (kind, name)).handle_later()
         allowed_keys = table[kind]
 
         self.check_name(name)
         self.check_keys(name, definition, allowed_keys)
         self.check_keys_field(name, definition)
         self.check_field_types(name, definition)
-        self.check_whitelisted_kind(name, definition)
-        self.check_whitelistable_fields(name, definition)
+        self.check_allowlisted_kind(name, definition)
+        self.check_allowlistable_fields(name, definition)
         self.check_expiration(name, definition)
         self.check_label_values(name, definition)
         self.check_record_in_processes(name, definition)
         self.check_products(name, definition)
         self.check_operating_systems(name, definition)
         self.check_record_into_store(name, definition)
 
     def check_name(self, name):
@@ -334,20 +334,20 @@ the histogram."""
     def check_expiration(self, name, definition):
         field = 'expires_in_version'
         expiration = definition.get(field)
 
         if not expiration:
             return
 
         # We forbid new probes from using "expires_in_version" : "default" field/value pair.
-        # Old ones that use this are added to the whitelist.
+        # Old ones that use this are added to the allowlist.
         if expiration == "default" and \
-           whitelists is not None and \
-           name not in whitelists['expiry_default']:
+           allowlists is not None and \
+           name not in allowlists['expiry_default']:
             ParserError('New histogram "%s" cannot have "default" %s value.' %
                         (name, field)).handle_later()
 
         # Historical editions of Histograms.json can have the deprecated
         # expiration format 'N.Na1'. Fortunately, those scripts set
         # self._strict_type_checks to false.
         if expiration != "default" and \
            not utils.validate_expiration_version(expiration) and \
@@ -467,57 +467,57 @@ the histogram."""
         if len(keys) > MAX_KEY_COUNT:
             raise ValueError('Label count for %s exceeds limit of %d' % (name, MAX_KEY_COUNT))
 
         invalid = filter(lambda k: len(k) > MAX_KEY_LENGTH, keys)
         if len(invalid) > 0:
             raise ValueError('"keys" values for %s are exceeding length "%d": %s' %
                              (name, MAX_KEY_LENGTH, ', '.join(invalid)))
 
-    def check_whitelisted_kind(self, name, definition):
+    def check_allowlisted_kind(self, name, definition):
         # We don't need to run any of these checks on the server.
-        if not self._strict_type_checks or whitelists is None:
+        if not self._strict_type_checks or allowlists is None:
             return
 
         # Disallow "flag" and "count" histograms on desktop, suggest to use
         # scalars instead. Allow using these histograms on Android, as we
         # don't support scalars there yet.
         hist_kind = definition.get("kind")
         android_target = "android" in definition.get("operating_systems", [])
 
         if not android_target and \
            hist_kind in ["flag", "count"] and \
-           name not in whitelists["kind"]:
+           name not in allowlists["kind"]:
             ParserError(('Unsupported kind "%s" for histogram "%s":\n'
                          'New "%s" histograms are not supported on Desktop, you should'
                          ' use scalars instead:\n'
                          '%s\n'
                          'Are you trying to add a histogram on Android?'
                          ' Add "operating_systems": ["android"] to your histogram definition.')
                         % (hist_kind, name, hist_kind, SCALARS_DOC_URL)).handle_now()
 
-    # Check for the presence of fields that old histograms are whitelisted for.
-    def check_whitelistable_fields(self, name, definition):
+    # Check for the presence of fields that old histograms are allowlisted for.
+    def check_allowlistable_fields(self, name, definition):
         # Use counters don't have any mechanism to add the fields checked here,
         # so skip the check for them.
         # We also don't need to run any of these checks on the server.
         if self._is_use_counter or not self._strict_type_checks:
             return
 
-        # In the pipeline we don't have whitelists available.
-        if whitelists is None:
+        # In the pipeline we don't have allowlists available.
+        if allowlists is None:
             return
 
         for field in ['alert_emails', 'bug_numbers']:
-            if field not in definition and name not in whitelists[field]:
+            if field not in definition and name not in allowlists[field]:
                 ParserError('New histogram "%s" must have a "%s" field.' %
                             (name, field)).handle_later()
-            if field in definition and name in whitelists[field]:
-                msg = 'Histogram "%s" should be removed from the whitelist for "%s" in ' \
-                      'histogram-whitelists.json.'
+            if field in definition and name in allowlists[field]:
+                msg = 'Histogram "%s" should be removed from the allowlist for "%s" in ' \
+                      'histogram-allowlists.json.'
                 ParserError(msg % (name, field)).handle_later()
 
     def check_field_types(self, name, definition):
         # Define expected types for the histogram properties.
         type_checked_fields = {
             "n_buckets": int,
             "n_values": int,
             "low": int,
@@ -596,18 +596,18 @@ the histogram."""
             if key not in allowed_keys:
                 ParserError('Key "%s" is not allowed for histogram "%s".' %
                             (key, name)).handle_later()
 
     def set_bucket_parameters(self, low, high, n_buckets):
         self._low = low
         self._high = high
         self._n_buckets = n_buckets
-        if whitelists is not None and self._n_buckets > 100 and type(self._n_buckets) is int:
-            if self._name not in whitelists['n_buckets']:
+        if allowlists is not None and self._n_buckets > 100 and type(self._n_buckets) is int:
+            if self._name not in allowlists['n_buckets']:
                 ParserError(
                     'New histogram "%s" is not permitted to have more than 100 buckets.\n'
                     'Histograms with large numbers of buckets use disproportionately high'
                     ' amounts of resources. Contact a Telemetry peer (e.g. in #telemetry)'
                     ' if you think an exception ought to be made:\n'
                     'https://wiki.mozilla.org/Modules/Toolkit#Telemetry'
                     % self._name
                     ).handle_later()
@@ -746,17 +746,17 @@ except ImportError:
     pass
 
 
 def from_files(filenames, strict_type_checks=True):
     """Return an iterator that provides a sequence of Histograms for
 the histograms defined in filenames.
     """
     if strict_type_checks:
-        load_whitelist()
+        load_allowlist()
 
     all_histograms = OrderedDict()
     for filename in filenames:
         parser = FILENAME_PARSERS[os.path.basename(filename)]
         histograms = parser(filename, strict_type_checks)
 
         # OrderedDicts are important, because then the iteration order over
         # the parsed histograms is stable, which makes the insertion into
@@ -778,19 +778,19 @@ the histograms defined in filenames.
         lower_bound = use_counter_indices[0][0]
         upper_bound = use_counter_indices[-1][0]
         n_counters = upper_bound - lower_bound + 1
         if n_counters != len(use_counter_indices):
             ParserError("Use counter histograms must be defined in a contiguous block."
                         ).handle_later()
 
     # Check that histograms that were removed from Histograms.json etc.
-    # are also removed from the whitelists.
-    if whitelists is not None:
-        all_whitelist_entries = itertools.chain.from_iterable(whitelists.itervalues())
-        orphaned = set(all_whitelist_entries) - set(all_histograms.keys())
+    # are also removed from the allowlists.
+    if allowlists is not None:
+        all_allowlist_entries = itertools.chain.from_iterable(allowlists.itervalues())
+        orphaned = set(all_allowlist_entries) - set(all_histograms.keys())
         if len(orphaned) > 0:
             msg = 'The following entries are orphaned and should be removed from ' \
-                  'histogram-whitelists.json:\n%s'
+                  'histogram-allowlists.json:\n%s'
             ParserError(msg % (', '.join(sorted(orphaned)))).handle_later()
 
     for (name, definition) in all_histograms.iteritems():
         yield Histogram(name, definition, strict_type_checks=strict_type_checks)
--- a/toolkit/components/telemetry/core/Telemetry.cpp
+++ b/toolkit/components/telemetry/core/Telemetry.cpp
@@ -1393,34 +1393,34 @@ nsCString TelemetryImpl::SanitizeSQL(con
   }
 
   if ((fragmentStart >= 0) && fragmentStart < length)
     output += nsDependentCSubstring(sql, fragmentStart, length - fragmentStart);
 
   return output;
 }
 
-// A whitelist mechanism to prevent Telemetry reporting on Addon & Thunderbird
+// An allowlist mechanism to prevent Telemetry reporting on Addon & Thunderbird
 // DBs.
 struct TrackedDBEntry {
   const char* mName;
   const uint32_t mNameLength;
 
   // This struct isn't meant to be used beyond the static arrays below.
   constexpr TrackedDBEntry(const char* aName, uint32_t aNameLength)
       : mName(aName), mNameLength(aNameLength) {}
 
   TrackedDBEntry() = delete;
   TrackedDBEntry(TrackedDBEntry&) = delete;
 };
 
 #define TRACKEDDB_ENTRY(_name) \
   { _name, (sizeof(_name) - 1) }
 
-// A whitelist of database names. If the database name exactly matches one of
+// An allowlist of database names. If the database name exactly matches one of
 // these then its SQL statements will always be recorded.
 static constexpr TrackedDBEntry kTrackedDBs[] = {
     // IndexedDB for about:home, see aboutHome.js
     TRACKEDDB_ENTRY("818200132aebmoouht.sqlite"),
     TRACKEDDB_ENTRY("addons.sqlite"),
     TRACKEDDB_ENTRY("content-prefs.sqlite"),
     TRACKEDDB_ENTRY("cookies.sqlite"),
     TRACKEDDB_ENTRY("extensions.sqlite"),
@@ -1431,17 +1431,17 @@ static constexpr TrackedDBEntry kTracked
     TRACKEDDB_ENTRY("permissions.sqlite"),
     TRACKEDDB_ENTRY("places.sqlite"),
     TRACKEDDB_ENTRY("reading-list.sqlite"),
     TRACKEDDB_ENTRY("search.sqlite"),
     TRACKEDDB_ENTRY("signons.sqlite"),
     TRACKEDDB_ENTRY("urlclassifier3.sqlite"),
     TRACKEDDB_ENTRY("webappsstore.sqlite")};
 
-// A whitelist of database name prefixes. If the database name begins with
+// An allowlist of database name prefixes. If the database name begins with
 // one of these prefixes then its SQL statements will always be recorded.
 static const TrackedDBEntry kTrackedDBPrefixes[] = {
     TRACKEDDB_ENTRY("indexedDB-")};
 
 #undef TRACKEDDB_ENTRY
 
 // Slow SQL statements will be automatically
 // trimmed to kMaxSlowStatementLength characters.
@@ -1896,17 +1896,17 @@ void RecordShutdownEndTimeStamp() {
   nsTAutoString<PathChar> tmpName(name);
   tmpName.AppendLiteral(".tmp");
   RefPtr<nsLocalFile> tmpFile = new nsLocalFile(tmpName);
   FILE* f;
   if (NS_FAILED(tmpFile->OpenANSIFileDesc("w", &f)) || !f) return;
   // On a normal release build this should be called just before
   // calling _exit, but on a debug build or when the user forces a full
   // shutdown this is called as late as possible, so we have to
-  // white list this write as write poisoning will be enabled.
+  // allow this write as write poisoning will be enabled.
   MozillaRegisterDebugFILE(f);
 
   TimeStamp now = TimeStamp::Now();
   MOZ_ASSERT(now >= gRecordedShutdownStartTime);
   TimeDuration diff = now - gRecordedShutdownStartTime;
   uint32_t diff2 = diff.ToMilliseconds();
   int written = fprintf(f, "%d\n", diff2);
   MozillaUnRegisterDebugFILE(f);
--- a/toolkit/components/telemetry/docs/collection/hybrid-content.rst
+++ b/toolkit/components/telemetry/docs/collection/hybrid-content.rst
@@ -20,17 +20,20 @@ Telemetry can be sent from web content b
 
 1. granting the web content's host privileges in the Firefox codebase;
 2. including the ``HybridContentTelemetry-lib.js`` file in the page;
 3. registering the probes after the library is loaded;
 4. using the API to send Telemetry.
 
 Granting the privileges
 -----------------------
-For security/privacy reasons `Mozilla.ContentTelemetry` will only work on a list of allowed secure origins. The list of allowed origins can be found in `browser/app/permissions <https://dxr.mozilla.org/mozilla-central/source/browser/app/permissions>`_ . A host needs to be given the ``hc_telemetry`` permission in order to be whitelisted.
+For security/privacy reasons `Mozilla.ContentTelemetry` will only work on a list of allowed secure origins.
+The list of allowed origins can be found in
+`browser/app/permissions <https://dxr.mozilla.org/mozilla-central/source/browser/app/permissions>`_ .
+A host needs to be given the ``hc_telemetry`` permission in order to be allowed to use the API.
 
 Example:
 
 ::
 
   origin  hc_telemetry  1 https://discovery.addons.mozilla.org
 
 Adding an entry to the ``permissions`` file requires riding the trains. If "go-faster" content requires
rename from toolkit/components/telemetry/histogram-whitelists.json
rename to toolkit/components/telemetry/histogram-allowlists.json
--- a/toolkit/components/telemetry/other/TelemetryIOInterposeObserver.h
+++ b/toolkit/components/telemetry/other/TelemetryIOInterposeObserver.h
@@ -93,17 +93,17 @@ class TelemetryIOInterposeObserver : pub
 
   struct FileStatsByStage {
     FileStats mStats[NUM_STAGES];
   };
   typedef nsBaseHashtableET<nsStringHashKey, FileStatsByStage> FileIOEntryType;
 
   // Statistics for each filename
   Common::AutoHashtable<FileIOEntryType> mFileStats;
-  // Container for whitelisted directories
+  // Container for allowed directories
   nsTArray<SafeDir> mSafeDirs;
   Stage mCurStage;
 
   /**
    * Reflect a FileIOEntryType object to a Javascript property on obj with
    * filename as key containing array:
    * [totalTime, creates, reads, writes, fsyncs, stats]
    */
--- a/toolkit/components/telemetry/tests/browser/browser_HybridContentTelemetry.js
+++ b/toolkit/components/telemetry/tests/browser/browser_HybridContentTelemetry.js
@@ -127,21 +127,21 @@ add_task(async function test_untrusted_h
 
   // Finally clean up the listener.
   BrowserTestUtils.removeTab(newTab);
   Services.perms.remove(testHttpUri, HC_PERMISSION);
   Services.mm.removeMessageListener(messageName, makeTestFail);
   Services.telemetry.setEventRecordingEnabled("telemetry.test", false);
 });
 
-add_task(async function test_secure_non_whitelisted_origin() {
+add_task(async function test_secure_unallowed_origin() {
   Services.telemetry.clearEvents();
 
   // Install a custom handler that intercepts hybrid content telemetry messages
-  // and makes the test fail. We don't expect any message from non whitelisted pages.
+  // and makes the test fail. We don't expect any message from unallowed pages.
   const messageName = "HybridContentTelemetry:onTelemetryMessage";
   let makeTestFail = () => ok(false, `Received an unexpected ${messageName}.`);
   Services.mm.addMessageListener(messageName, makeTestFail);
 
   // Try to use the API on a secure host but don't give the page enough privileges.
   const testHost = "https://example.org";
   let url = getRootDirectory(gTestPath) + "hybrid_content.html";
   url = url.replace("chrome://mochitests/content", testHost);
--- a/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py
+++ b/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py
@@ -26,334 +26,334 @@ class TestParser(unittest.TestCase):
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "products": ["firefox"],
                 "description": "Test histogram"
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         hist = parse_histograms.Histogram('TEST_VALID_HISTOGRAM',
                                           histograms['TEST_VALID_HISTOGRAM'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertTrue(hist.expiration(), "never")
         self.assertTrue(hist.kind(), "boolean")
         self.assertTrue(hist.record_in_processes, ["main", "content"])
         self.assertTrue(hist.record_into_store, ["main"])
 
     def test_missing_bug_numbers(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS": {
+            "TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS": {
                 "record_in_processes": ["main", "content"],
                 "alert_emails": ["team@mozilla.xyz"],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "products": ["firefox"],
                 "description": "Test histogram"
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
-        parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS',
-                                   histograms['TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS'],
+        parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS',
+                                   histograms['TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS'],
                                    strict_type_checks=True)
 
         self.assertRaises(SystemExit, ParserError.exit_func)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [],
             "bug_numbers": [
-                "TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS"
+                "TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS"
             ],
             "n_buckets": [],
             "expiry_default": [],
             "kind": []
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_BUG_NUMBERS'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_BUG_NUMBERS'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'never')
         self.assertEqual(hist.kind(), 'boolean')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_missing_alert_emails(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS": {
+            "TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS": {
                 "record_in_processes": ["main", "content"],
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
-        parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS',
-                                   histograms['TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS'],
+        parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS',
+                                   histograms['TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS'],
                                    strict_type_checks=True)
 
         self.assertRaises(SystemExit, ParserError.exit_func)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [
-                "TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS"
+                "TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS"
             ],
             "bug_numbers": [],
             "n_buckets": [],
             "expiry_default": [],
             "kind": []
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_ALERT_EMAILS'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_ALERT_EMAILS'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'never')
         self.assertEqual(hist.kind(), 'boolean')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_high_value(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_N_BUCKETS": {
+            "TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS": {
                 "record_in_processes": ["main", "content"],
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "exponential",
                 "low": 1024,
                 "high": 2 ** 64,
                 "n_buckets": 100,
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
-        parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_N_BUCKETS',
-                                   histograms['TEST_HISTOGRAM_WHITELIST_N_BUCKETS'],
+        parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS',
+                                   histograms['TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS'],
                                    strict_type_checks=True)
 
         self.assertRaises(SystemExit, ParserError.exit_func)
 
     def test_high_n_buckets(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_N_BUCKETS": {
+            "TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS": {
                 "record_in_processes": ["main", "content"],
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "exponential",
                 "low": 1024,
                 "high": 16777216,
                 "n_buckets": 200,
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
-        parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_N_BUCKETS',
-                                   histograms['TEST_HISTOGRAM_WHITELIST_N_BUCKETS'],
+        parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS',
+                                   histograms['TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS'],
                                    strict_type_checks=True)
 
         self.assertRaises(SystemExit, ParserError.exit_func)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [],
             "bug_numbers": [],
             "n_buckets": [
-                "TEST_HISTOGRAM_WHITELIST_N_BUCKETS"
+                "TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS"
             ],
             "expiry_default": [],
             "kind": []
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_N_BUCKETS',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_N_BUCKETS'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_N_BUCKETS'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'never')
         self.assertEqual(hist.kind(), 'exponential')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
         self.assertEqual(hist.low(), 1024)
         self.assertEqual(hist.high(), 16777216)
         self.assertEqual(hist.n_buckets(), 200)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_expiry_default(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT": {
+            "TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT": {
                 "record_in_processes": ["main", "content"],
                 "expires_in_version": "default",
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "kind": "boolean",
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
-        parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT',
-                                   histograms['TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT'],
+        parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT',
+                                   histograms['TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT'],
                                    strict_type_checks=True)
 
         self.assertRaises(SystemExit, ParserError.exit_func)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [],
             "bug_numbers": [],
             "n_buckets": [],
             "expiry_default": [
-                "TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT"
+                "TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT"
             ],
             "kind": []
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_EXPIRY_DEFAULT'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_EXPIRY_DEFAULT'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'default')
         self.assertEqual(hist.kind(), 'boolean')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_unsupported_kind_count(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_KIND": {
+            "TEST_HISTOGRAM_ALLOWLIST_KIND": {
                 "record_in_processes": ["main", "content"],
                 "expires_in_version": "never",
                 "kind": "count",
                 "releaseChannelCollection": "opt-out",
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         self.assertRaises(SystemExit, parse_histograms.Histogram,
-                          'TEST_HISTOGRAM_WHITELIST_KIND',
-                          histograms['TEST_HISTOGRAM_WHITELIST_KIND'],
+                          'TEST_HISTOGRAM_ALLOWLIST_KIND',
+                          histograms['TEST_HISTOGRAM_ALLOWLIST_KIND'],
                           strict_type_checks=True)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [],
             "bug_numbers": [],
             "n_buckets": [],
             "expiry_default": [],
             "kind": [
-                "TEST_HISTOGRAM_WHITELIST_KIND"
+                "TEST_HISTOGRAM_ALLOWLIST_KIND"
             ]
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_KIND',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_KIND'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_KIND',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_KIND'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'never')
         self.assertEqual(hist.kind(), 'count')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_unsupported_kind_flag(self):
         SAMPLE_HISTOGRAM = {
-            "TEST_HISTOGRAM_WHITELIST_KIND": {
+            "TEST_HISTOGRAM_ALLOWLIST_KIND": {
                 "record_in_processes": ["main", "content"],
                 "expires_in_version": "never",
                 "kind": "flag",
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "products": ["firefox"],
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         self.assertRaises(SystemExit, parse_histograms.Histogram,
-                          'TEST_HISTOGRAM_WHITELIST_KIND',
-                          histograms['TEST_HISTOGRAM_WHITELIST_KIND'],
+                          'TEST_HISTOGRAM_ALLOWLIST_KIND',
+                          histograms['TEST_HISTOGRAM_ALLOWLIST_KIND'],
                           strict_type_checks=True)
 
-        # Set global whitelists for parse_histograms.
-        parse_histograms.whitelists = {
+        # Set global allowlists for parse_histograms.
+        parse_histograms.allowlists = {
             "alert_emails": [],
             "bug_numbers": [],
             "n_buckets": [],
             "expiry_default": [],
             "kind": [
-                "TEST_HISTOGRAM_WHITELIST_KIND"
+                "TEST_HISTOGRAM_ALLOWLIST_KIND"
             ]
         }
 
-        hist = parse_histograms.Histogram('TEST_HISTOGRAM_WHITELIST_KIND',
-                                          histograms['TEST_HISTOGRAM_WHITELIST_KIND'],
+        hist = parse_histograms.Histogram('TEST_HISTOGRAM_ALLOWLIST_KIND',
+                                          histograms['TEST_HISTOGRAM_ALLOWLIST_KIND'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEqual(hist.expiration(), 'never')
         self.assertEqual(hist.kind(), 'flag')
         self.assertEqual(hist.record_in_processes(), ["main", "content"])
         self.assertEqual(hist.keyed(), False)
 
-        parse_histograms.whitelists = None
+        parse_histograms.allowlists = None
 
     def test_multistore(self):
         SAMPLE_HISTOGRAM = {
             "TEST_VALID_HISTOGRAM": {
                 "record_in_processes": ["main", "content"],
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Test histogram",
                 "products": ["firefox"],
                 "record_into_store": ["main", "sync"],
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         hist = parse_histograms.Histogram('TEST_VALID_HISTOGRAM',
                                           histograms['TEST_VALID_HISTOGRAM'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertTrue(hist.expiration(), "never")
         self.assertTrue(hist.kind(), "boolean")
@@ -368,17 +368,17 @@ class TestParser(unittest.TestCase):
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Test histogram",
                 "products": ["firefox"],
                 "record_into_store": [],
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         parse_histograms.Histogram('TEST_HISTOGRAM_EMPTY_MULTISTORE',
                                    histograms['TEST_HISTOGRAM_EMPTY_MULTISTORE'],
                                    strict_type_checks=True)
         self.assertRaises(SystemExit, ParserError.exit_func)
 
     def test_products_absent(self):
         SAMPLE_HISTOGRAM = {
@@ -387,17 +387,17 @@ class TestParser(unittest.TestCase):
                 "alert_emails": ["team@mozilla.xyz"],
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Test histogram",
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         def test_parse(): return parse_histograms.Histogram('TEST_NO_PRODUCTS',
                                                             histograms['TEST_NO_PRODUCTS'],
                                                             strict_type_checks=True)
         self.assertRaises(SystemExit, test_parse)
 
     def test_products_empty(self):
         SAMPLE_HISTOGRAM = {
@@ -407,17 +407,17 @@ class TestParser(unittest.TestCase):
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Test histogram",
                 "products": [],
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         def test_parse(): return parse_histograms.Histogram('TEST_EMPTY_PRODUCTS',
                                                             histograms['TEST_EMPTY_PRODUCTS'],
                                                             strict_type_checks=True)
         self.assertRaises(SystemExit, test_parse)
 
     def test_products_all(self):
         SAMPLE_HISTOGRAM = {
@@ -427,17 +427,17 @@ class TestParser(unittest.TestCase):
                 "bug_numbers": [1383793],
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Test histogram",
                 "products": ["all"],
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         parse_histograms.Histogram('TEST_HISTOGRAM_ALL_PRODUCTS',
                                    histograms['TEST_HISTOGRAM_ALL_PRODUCTS'],
                                    strict_type_checks=True)
         self.assertRaises(SystemExit, ParserError.exit_func)
 
 
 if __name__ == '__main__':
--- a/toolkit/components/telemetry/tests/python/test_usecounters.py
+++ b/toolkit/components/telemetry/tests/python/test_usecounters.py
@@ -22,17 +22,17 @@ class TestParser(unittest.TestCase):
         SAMPLE_HISTOGRAM = {
             "USE_COUNTER2_TEST_HISTOGRAM": {
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Whether a foo used bar"
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         hist = parse_histograms.Histogram('USE_COUNTER2_TEST_HISTOGRAM',
                                           histograms['USE_COUNTER2_TEST_HISTOGRAM'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEquals(hist.dataset(), "nsITelemetry::DATASET_ALL_CHANNELS")
         self.assertEquals(hist.products(), ["firefox", "fennec", "geckoview"])
@@ -41,17 +41,17 @@ class TestParser(unittest.TestCase):
         SAMPLE_HISTOGRAM = {
             "USE_COUNTER2_TEST_HISTOGRAM": {
                 "expires_in_version": "never",
                 "kind": "boolean",
                 "description": "Whether a foo used bar"
             }
         }
         histograms = load_histogram(SAMPLE_HISTOGRAM)
-        parse_histograms.load_whitelist()
+        parse_histograms.load_allowlist()
 
         hist = parse_histograms.Histogram('USE_COUNTER2_TEST_HISTOGRAM',
                                           histograms['USE_COUNTER2_TEST_HISTOGRAM'],
                                           strict_type_checks=True)
 
         ParserError.exit_func()
         self.assertEquals(hist.expiration(), "never")
         self.assertEquals(hist.kind(), "boolean")