[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 02/70: Bug 1769030: Add a configure flag to load policies only from the local policies.json file r=mkaply, glandium



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.2.0esr-12.0-1
in repository tor-browser.

commit e0bdba0a4cbc5f4ea36b5fda62be4dfaab6aa725
Author: Pier Angelo Vendrame <pierov@xxxxxxxxxxxxxx>
AuthorDate: Tue Aug 16 14:42:20 2022 +0000

    Bug 1769030: Add a configure flag to load policies only from the local policies.json file r=mkaply,glandium
    
    Add a configuration flag to make Enterprise Policies mechanism only
    consult a policies.json file (avoiding the Windows Registry, macOS's
    file system attributes, and /etc/firefox/policies/policies.json on
    other OS).
    
    Differential Revision: https://phabricator.services.mozilla.com/D146300
---
 .../components/enterprisepolicies/EnterprisePoliciesParent.jsm |  9 ++++++---
 toolkit/modules/AppConstants.jsm                               |  7 +++++++
 toolkit/modules/moz.build                                      |  1 +
 toolkit/moz.configure                                          | 10 ++++++++++
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
index bfb8c02573f22..1ec347ca3f5d1 100644
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
@@ -140,9 +140,12 @@ EnterprisePoliciesManager.prototype = {
 
   _chooseProvider() {
     let platformProvider = null;
-    if (AppConstants.platform == "win") {
+    if (AppConstants.platform == "win" && AppConstants.MOZ_SYSTEM_POLICIES) {
       platformProvider = new WindowsGPOPoliciesProvider();
-    } else if (AppConstants.platform == "macosx") {
+    } else if (
+      AppConstants.platform == "macosx" &&
+      AppConstants.MOZ_SYSTEM_POLICIES
+    ) {
       platformProvider = new macOSPoliciesProvider();
     }
     let jsonProvider = new JSONPoliciesProvider();
@@ -526,7 +529,7 @@ class JSONPoliciesProvider {
   _getConfigurationFile() {
     let configFile = null;
 
-    if (AppConstants.platform == "linux") {
+    if (AppConstants.platform == "linux" && AppConstants.MOZ_SYSTEM_POLICIES) {
       let systemConfigFile = Cc["@mozilla.org/file/local;1"].createInstance(
         Ci.nsIFile
       );
diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm
index 7f8ac95dd9625..5799b78178aaf 100644
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -453,6 +453,13 @@ this.AppConstants = Object.freeze({
     false,
 #endif
 
+  MOZ_SYSTEM_POLICIES:
+#ifdef MOZ_SYSTEM_POLICIES
+    true,
+#else
+    false,
+#endif
+
   // Returns true for CN region build when distibution id set as 'MozillaOnline'
   isChinaRepack() {
     return (
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index 26acb92b37b7c..f8f65aef789e0 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -292,6 +292,7 @@ for var in (
     "MOZ_ALLOW_ADDON_SIDELOAD",
     "MOZ_BACKGROUNDTASKS",
     "MOZ_SYSTEM_NSS",
+    "MOZ_SYSTEM_POLICIES",
     "MOZ_UNSIGNED_APP_SCOPE",
     "MOZ_UNSIGNED_SYSTEM_SCOPE",
     "MOZ_UPDATE_AGENT",
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 0dd52bd5203b7..a3dcca6909017 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -3210,3 +3210,13 @@ with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT"
     set_define("HAVE_ARC4RANDOM", check_symbol("arc4random"))
     set_define("HAVE_ARC4RANDOM_BUF", check_symbol("arc4random_buf"))
     set_define("HAVE_MALLINFO", check_symbol("mallinfo"))
+
+# System policies
+# ==============================================================
+
+option(
+    "--disable-system-policies",
+    help="Disable reading policies from Windows registry, macOS's file system attributes, and /etc/firefox",
+)
+
+set_config("MOZ_SYSTEM_POLICIES", True, when="--enable-system-policies")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits