[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 34/85: Bug 32418: Add a configure flag to load policies only from the local policies.json
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-91.9.0esr-11.5-2
in repository tor-browser.
commit ee630bac7d57b87a7913ac5f3351a3f9cb2b3249
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
AuthorDate: Thu Apr 16 17:07:09 2020 -0400
Bug 32418: Add a configure flag to load policies only from the local policies.json
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).
We avoid system policies because their proxy settings override our
preferences, however updates can be disabled only with enterprise
policies, so we allow them from a local file as a trade off.
---
browser/config/mozconfigs/base-browser | 1 +
.../enterprisepolicies/EnterprisePoliciesParent.jsm | 13 +++++++++++--
toolkit/components/enterprisepolicies/moz.build | 3 +++
toolkit/moz.configure | 18 ++++++++++++++++++
4 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/browser/config/mozconfigs/base-browser b/browser/config/mozconfigs/base-browser
index 9963ab7ef9e62..cdc493f473022 100644
--- a/browser/config/mozconfigs/base-browser
+++ b/browser/config/mozconfigs/base-browser
@@ -26,6 +26,7 @@ ac_add_options --disable-parental-controls
# Let's make sure no preference is enabling either Adobe's or Google's CDM.
ac_add_options --disable-eme
ac_add_options --enable-proxy-bypass-protection
+ac_add_options --disable-system-policies
# Disable telemetry
ac_add_options MOZ_TELEMETRY_REPORTING=
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
index f5de14798de15..8022d65ab0b2d 100644
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
@@ -4,6 +4,9 @@
var EXPORTED_SYMBOLS = ["EnterprisePoliciesManager"];
+// If MOZ_AVOID_SYSTEM_POLICIES is defined, policies will be looked for only
+// in ${InstallDir}/distribution
+
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
@@ -13,9 +16,11 @@ const { AppConstants } = ChromeUtils.import(
);
XPCOMUtils.defineLazyModuleGetters(this, {
+#ifndef MOZ_AVOID_SYSTEM_POLICIES
WindowsGPOParser: "resource://gre/modules/policies/WindowsGPOParser.jsm",
macOSPoliciesParser:
"resource://gre/modules/policies/macOSPoliciesParser.jsm",
+#endif
Policies: "resource:///modules/policies/Policies.jsm",
JsonSchemaValidator:
"resource://gre/modules/components-utils/JsonSchemaValidator.jsm",
@@ -140,11 +145,13 @@ EnterprisePoliciesManager.prototype = {
_chooseProvider() {
let platformProvider = null;
+#ifndef MOZ_AVOID_SYSTEM_POLICIES
if (AppConstants.platform == "win") {
platformProvider = new WindowsGPOPoliciesProvider();
} else if (AppConstants.platform == "macosx") {
platformProvider = new macOSPoliciesProvider();
}
+#endif
let jsonProvider = new JSONPoliciesProvider();
if (platformProvider && platformProvider.hasPolicies) {
if (jsonProvider.hasPolicies) {
@@ -491,7 +498,7 @@ class JSONPoliciesProvider {
_getConfigurationFile() {
let configFile = null;
-
+#ifndef MOZ_AVOID_SYSTEM_POLICIES
if (AppConstants.platform == "linux") {
let systemConfigFile = Cc["@mozilla.org/file/local;1"].createInstance(
Ci.nsIFile
@@ -504,7 +511,7 @@ class JSONPoliciesProvider {
return systemConfigFile;
}
}
-
+#endif
try {
let perUserPath = Services.prefs.getBoolPref(PREF_PER_USER_DIR, false);
if (perUserPath) {
@@ -585,6 +592,7 @@ class JSONPoliciesProvider {
}
}
+#ifndef MOZ_AVOID_SYSTEM_POLICIES
class WindowsGPOPoliciesProvider {
constructor() {
this._policies = null;
@@ -686,3 +694,4 @@ class CombinedProvider {
return false;
}
}
+#endif
diff --git a/toolkit/components/enterprisepolicies/moz.build b/toolkit/components/enterprisepolicies/moz.build
index 09d2046e1bd79..3f685d3fbbd66 100644
--- a/toolkit/components/enterprisepolicies/moz.build
+++ b/toolkit/components/enterprisepolicies/moz.build
@@ -19,6 +19,9 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android":
EXTRA_JS_MODULES += [
"EnterprisePolicies.jsm",
"EnterprisePoliciesContent.jsm",
+ ]
+
+ EXTRA_PP_JS_MODULES += [
"EnterprisePoliciesParent.jsm",
]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 026e7fa7ba512..ffda1f21d7d64 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -2530,3 +2530,21 @@ def oxidized_breakpad(target):
set_config("MOZ_OXIDIZED_BREAKPAD", True, when=oxidized_breakpad)
set_define("MOZ_OXIDIZED_BREAKPAD", True, when=oxidized_breakpad)
+
+# Avoid system policies
+# ==============================================================
+
+option(
+ "--disable-system-policies",
+ help="Prevent reading policies from Windows registry, macOS's file system attributes, and /etc/firefox",
+)
+
+
+@depends("--disable-system-policies")
+def system_policies(value):
+ if not value:
+ return True
+
+
+set_config("MOZ_AVOID_SYSTEM_POLICIES", system_policies)
+set_define("MOZ_AVOID_SYSTEM_POLICIES", 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