Firefox · Toolkit
CVE-2026-74985
Logic Error in Toolkit
Overview
Low
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
onBeforeAddonsbrowser/components/enterprisepolicies/Policies.sys.mjs |
modified | |
ifbrowser/components/enterprisepolicies/Policies.sys.mjs |
modified | |
iftoolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs |
modified | |
_readDatatoolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs |
modified |
Files Changed
browser/components/enterprisepolicies/Policies.sys.mjstoolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjstoolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
Patch
diff --git a/browser/components/enterprisepolicies/Policies.sys.mjs b/browser/components/enterprisepolicies/Policies.sys.mjs
index 9aad627a7f6..2009e0af4e7 100644
--- a/browser/components/enterprisepolicies/Policies.sys.mjs
+++ b/browser/components/enterprisepolicies/Policies.sys.mjs
@@ -49,8 +49,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
const PREF_LOGLEVEL = "browser.policies.loglevel";
const BROWSER_DOCUMENT_URL = AppConstants.BROWSER_CHROME_URL;
-const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
-
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
@@ -95,7 +93,7 @@ export var Policies = {
// Use the same timing that you used for setting up the policy.
_cleanup: {
onBeforeAddons() {
- if (Cu.isInAutomation || isXpcshell) {
+ if (Cu.isInAutomation) {
lazy.clearBlockedAboutPages();
}
Services.obs.notifyObservers(
diff --git a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
index 4da86126cc0..2e213da105b 100644
--- a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
+++ b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
@@ -5,6 +5,14 @@
import { EnterprisePolicyTesting } from "resource://testing-common/EnterprisePolicyTesting.sys.mjs";
export async function runBackgroundTask(commandLine) {
+ // This process runs with its own profile, so it doesn't inherit the xpcshell
+ // harness's automation prefs, which the policy engine requires to read
+ // `browser.policies.alternatePath`.
+ Services.prefs.setBoolPref(
+ "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer",
+ true
+ );
+
let filePath = commandLine.getArgument(0);
await EnterprisePolicyTesting.setupPolicyEngineWithJson(filePath);
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
index 52971e49420..76ef9303765 100644
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
@@ -55,14 +55,12 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => {
});
});
-const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
+// Testing escapes in this file must key on Cu.isInAutomation.
-// On Nightly under a test harness, ignore real system/user policies so a
-// developer's local policies.json or registry entries don't leak into tests.
-// Restricted to Nightly so release builds never expose a way to bypass
-// enterprise policies via a test env var.
+// On Nightly in automation, ignore real system/user policies so a developer's
+// local policies.json or registry entries don't leak into tests.
function shouldIgnoreLocalPolicies() {
- return AppConstants.NIGHTLY_BUILD && (Cu.isInAutomation || isXpcshell);
+ return AppConstants.NIGHTLY_BUILD && Cu.isInAutomation;
}
// We're only testing for empty objects, not
@@ -701,7 +699,7 @@ class JSONPoliciesProvider extends PoliciesProvider {
// work as expected.
if (
alternatePath &&
- (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD || isXpcshell) &&
+ (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD) &&
(!configFile || !configFile.exists())
) {
if (alternatePath.startsWith(MAGIC_TEST_ROOT_PREFIX)) {
@@ -773,7 +771,7 @@ class WindowsGPOPoliciesProvider extends PoliciesProvider {
// user policies first and then replace them if necessary.
this._readData(wrk, wrk.ROOT_KEY_CURRENT_USER);
// We don't access machine policies in testing
- if (!Cu.isInAutomation && !isXpcshell) {
+ if (!Cu.isInAutomation) {
this._readData(wrk, wrk.ROOT_KEY_LOCAL_MACHINE);
}
}
@@ -781,7 +779,7 @@ class WindowsGPOPoliciesProvider extends PoliciesProvider {
_readData(wrk, root) {
try {
let regLocation = "SOFTWARE\\Policies";
- if (Cu.isInAutomation || isXpcshell) {
+ if (Cu.isInAutomation) {
let altLocation = Services.prefs.getStringPref(PREF_ALTERNATE_GPO, "");
if (altLocation) {
regLocation = altLocation;
Loading diff…
Regression Test / PoC
shipped with the fix
diff --git a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
index 4da86126cc0..2e213da105b 100644
--- a/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
+++ b/toolkit/components/backgroundtasks/tests/BackgroundTask_policies.sys.mjs
@@ -5,6 +5,14 @@
import { EnterprisePolicyTesting } from "resource://testing-common/EnterprisePolicyTesting.sys.mjs";
export async function runBackgroundTask(commandLine) {
+ // This process runs with its own profile, so it doesn't inherit the xpcshell
+ // harness's automation prefs, which the policy engine requires to read
+ // `browser.policies.alternatePath`.
+ Services.prefs.setBoolPref(
+ "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer",
+ true
+ );
+
let filePath = commandLine.getArgument(0);
await EnterprisePolicyTesting.setupPolicyEngineWithJson(filePath);
Loading diff…
References
On This Page