Closed Bug 1659719 Opened 4 years ago Closed 4 years ago

Add policy support for arbitrary preferences (based on prefixes)

Categories

(Firefox :: Enterprise Policies, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox-esr78 --- fixed
firefox81 --- verified
firefox82 --- verified

People

(Reporter: mkaply, Assigned: mkaply)

Details

Attachments

(1 file)

After discussion, we're going to add support for arbitrary preferences in policy and control them by having prefixes that aren't allowed and certain preferences that are blocked.

Pushed by mozilla@kaply.com: https://hg.mozilla.org/integration/autoland/rev/c7341a5c7b6c Add support for arbitrary preferences in policy. r=Gijs,dveditz
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

Comment on attachment 9170672 [details]
Bug 1659719 - Add support for arbitrary preferences in policy. r?Gijs!

Beta/Release Uplift Approval Request

  • User impact if declined: New policy not available.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Policy only, automated tests.
  • String changes made/needed:

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Implements new policy
  • User impact if declined: New policy not available.
  • Fix Landed on Version: 82
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Policy only, automated tests.
  • String or UUID changes made by this patch:
Attachment #9170672 - Flags: approval-mozilla-esr78?
Attachment #9170672 - Flags: approval-mozilla-beta?

This seems like a pretty big change, why do we think extra QA isn't needed here?

Flags: needinfo?(mozilla)

Well it didn't feel like a big change :). But yeah, asking for QA is fine. I never know what the "Needs manual test" is really for.

Which qa-triaged flag do I set?

To test, add the following to a policies.json file:

{
    "policies": {
      "Preferences": {
        "name_of_preference: {
          "Value": true,
          "Status": "default"
        }
      }
    }
}

Any preference that starts with these prefixes:

https://searchfox.org/mozilla-central/rev/d54712b9644b49cec6cc90a9e0c325fdfab04e7c/browser/components/enterprisepolicies/Policies.jsm#1466
or is in this list:
https://searchfox.org/mozilla-central/rev/d54712b9644b49cec6cc90a9e0c325fdfab04e7c/browser/components/enterprisepolicies/Policies.jsm#1481

will work.

Available Status are:

default, user, locked and clear

user preferences will persist across restart.
clear will only clear user preference.

The automated test is here:

https://searchfox.org/mozilla-central/source/browser/components/enterprisepolicies/tests/xpcshell/test_preferences.js

Flags: needinfo?(mozilla)

Comment on attachment 9170672 [details]
Bug 1659719 - Add support for arbitrary preferences in policy. r?Gijs!

Approved for 81.0b4. Let's get QA to take a look before we uplift to ESR78, though.

Attachment #9170672 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Hi Mike,

Can you please share the steps to reproduce we can follow in order to verify this on QA?

Do we have to create a policies.json file? Where do we save it?
Once it's saved, what are the next steps to verify this change is working?

Thanks in advance,
Virginia

Flags: needinfo?(mozilla)

Comment 6 has the information you need, but I'll provide more detail - https://bugzilla.mozilla.org/show_bug.cgi?id=1659719#c6

Create a file called policies.json. On Windows, create a directory called distribution where the EXE is located and place the file there. On Mac, the file goes into Firefox.app/Contents/Resources/distribution

In that file, you should put:

 {
 	"policies": {
 		"Preferences": {
 			"browser.policies.test.default.boolean": {
 				"Value": true,
 				"Status": "default"
 			}
 		}
 	}
 }

The value of "Value" depends on the pref.
The value of "Status" can either be default (set a default value), locked (lock a pref), user (set the user value of a pref), clear (clear an existrnig pref)

For the preference name, you can use existing preferences you see in about:config or create a new one.

You are verifying that the preference is set as default, locked or user set.

Flags: needinfo?(mozilla)

Hi all,

Thanks for the clarification to reproduce this.

I've used the following preference as a test on version 81.0b7 (64-bit) on Windows 10, and I verify that when changing status, the changes are reflected.

Status tested: default, locked, user and clear

{
"policies": {
"Preferences": {
"browser.policies.test.default.boolean": {
"Value": true,
"Status": "locked"
}
}
}
}

Just to verify, I also tested this on a previous version, 79.0 and I confirm that changes to the json file are not reflecting. The changes do reflect on version 81.0b7 (64-bit)

Regards,
Virginia

Adding that this has also been verified in 82.0a1 (2020-09-08) (64-bit).

Regards,
Virginia

Comment on attachment 9170672 [details]
Bug 1659719 - Add support for arbitrary preferences in policy. r?Gijs!

Thanks for the verification. Approved for 78.3esr.

Attachment #9170672 - Flags: approval-mozilla-esr78? → approval-mozilla-esr78+
Flags: qe-verify+
Summary: Add support for arbitrary preferences (based on prefixes) → Add policy support for arbitrary preferences (based on prefixes)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: