Gate each privileged extension feature by a webextension permission
Categories
(WebExtensions :: General, enhancement, P2)
Tracking
(firefox103 fixed)
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: TheOne, Assigned: mixedpuppy)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(3 files, 1 obsolete file)
In order to reliably distinguish regular add-ons from privileged add-ons at submission time (ie before they are getting signed), and the different submission processes for them, these systems need to be able to assess whether the submitting file can be handled by the receiving system.
In other words, when submitting an add-on/version that uses privileged features to AMO, AMO needs be able to recognize that and deny the submission.
Similarly, when submitting an add-on/version that does not use privileged features to shipit, shipit needs to able to recognize that and deny the submission.
Vice versa, AMO and shipit will be able to recognize and accept regular and privileged submissions respectively.
In order to achieve this, each privileged feature should be gated by a specific webextension permission, so those can be evaluated during submission.
Assignee | ||
Comment 1•3 years ago
|
||
Andreas: Is this a burning issue on AMO, or is it something that can take time to think about?
Reporter | ||
Comment 2•3 years ago
|
||
It is somewhat light-burning as it is a prerequisite for handling privileged add-ons on AMO and shipit. Is this something that could ride the 97 or 98 train?
Comment 3•3 years ago
|
||
It is not necessary to make Firefox-specific changes to support handling privileged add-ons in the signing infrastructure.
We could introduce a rule that an add-on needs a privileged permission (or a privileged manifest key such as experiment_apis
) in order to get a privileged signature. Then:
- Add-ons that already have a privileged permission will continue to be signed as desired.
- Add-ons that do not have a privileged permission yet can use one of the existing privileged permissions.
- Add-ons that do not have a privileged permission even though they should will discover soon enough that they need a privileged permission, and an existing privileged permission can be used as a dummy value.
The existing mozillaAddons
permission has a general name, but it does only one thing: expanding the set of supported match patterns. It's reasonable to expose that functionality.
Andreas, would that work for you?
Reporter | ||
Comment 4•3 years ago
|
||
As far as I understand, not every internal feature that requires a privileged permission is actually gated by one. To my understanding, some are only gated by the check for a privileged signature.
Comment 5•3 years ago
•
|
||
Indeed, some features are only gated by a privileged signature check and not by a privileged permission.
If the goal is merely to recognize supposedly privileged add-ons, then that can be done by recommending privileged add-ons to include a privileged permission (or even a dummy permission) as I mentioned in comment 3.
Otherwise, if we really want to check the use for every individual feature, then we'd need to introduce a new permission (or manifest key) for features that are not already behind a permission or manifest key.
The full list of features tied to the privileged state (= signed with a privileged signature / being a built-in extension / loaded temporarily with the experiments enabled preference) is as follows:
- bug 1323845, bug 1454820 - manifest.json's
experiment_apis
to load run unsandboxed code with chrome privileges - bug 1365349, bug 1543204 - manifest.json's
hidden
property to hide privileged/built-in extensions. - bug 1457865 - manifest.json's
l10n_resources
to allow localization of manifest properties.
(the above APIs are tied to a manifest key and don't require a new permission; the following ones may need a new permission) - bug 1580816 - l10n API in (privileged) extension documents.
- bug 1674383 -
SharedArrayBuffer
API for privileged extensions (in extension process only). - bug 1593651, bug 1608373 - expose
respectBeConservative
viaprivacy.settings
to privileged extensions. - bug 1593635 - expose
tlsVersionRestriction
viaprivacy.network
to privileged extensions. - bug 1525718 - privileged extensions can be enabled by default in private browsing mode.
- bug 1729969 (https://hg.mozilla.org/mozilla-central/rev/63cdac6cec7e) - to allow a privileged add-on to load extension scripts in the main process. A new permission would make more sense than the current implementation, but the check as a whole is expected to be a temporary hack.
- bug 1326572 -
geckoProfiler
API (predates thePRIVILEGED_PERMS
logic below) requires a privileged signature or be built-in, or be listed in theextensions.geckoProfiler.acceptedExtensionIds
pref. - bug 1394579, bug 1710917 - supports SVG context-fill for privileged Mozilla add-ons (or unprivileged ones with
@mozilla.com
/@mozilla.org
ID suffix). - Permissions requiring privileged signature in
PRIVILEGED_PERMS
: https://searchfox.org/mozilla-central/rev/3407e72ceb5039da514c03ae61bd279b1725c3b2/toolkit/components/extensions/Extension.jsm#165-172- bug 1280235 -
mozillaAddons
permission (see comment 3) - bug 1280234 -
telemetry
API - bug 1547285 -
urlbar
API - bug 1536658 -
normandyAddonStudy
API - bug 1542403 -
activityLog
API - bug 1550605 -
networkStatus
API - bug 1518843, bug 1601067 - (Android-only)
geckoviewAddons
andnativeMessagingFromContent
permissions (meant to be used by built-in extensions to communicate with the app). - bug 1739746 - (Android-only)
nativeMessaging
permission restricted to privileged extensions (on desktop any extension can usenativeMessaging
).
- bug 1280235 -
Comment 6•3 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #5)
Indeed, some features are only gated by a privileged signature check and not by a privileged permission.
If the goal is merely to recognize supposedly privileged add-ons, then that can be done by recommending privileged add-ons to include a privileged permission (or even a dummy permission) as I mentioned in comment 3.
:rpl didn't want us to (ab-)use mozillaAddons
, which is why I suggested to introduce a new dummy permission last time our team spoke about this issue.
I personally think that relying on a permission rather than the signature is superior because it is easier to lookup the permission in the manifest file.
Comment 7•3 years ago
|
||
Having a separate privileged permission for each use case of privileged features seems like too much overhead and bureaucracy, it could make it harder to reason about security and miss the forest for the trees while writing/reviewing code in firefox.
Furthermore, requiring any new permission (in Firefox) for things that previously didn't need one would break all existing already signed addons floating who knows where.
Possible middle ground would be to require mozillaAddons
for builtins (since we know of all of them) and temporary loaded extensions -- to obviously break them during development:
https://searchfox.org/mozilla-central/rev/633345116df55e2d37be9be6555aa739656c5a7d/toolkit/components/extensions/Extension.jsm#2224-2225
And after that we can use the presence of mozillaAddons
in the manifest to determine if AMO or ShipIt should be used for signing, and refuse in the other one.
Assignee | ||
Comment 8•3 years ago
|
||
Possible middle ground would be to require mozillaAddons for builtins
builtins do not require signing, so this should not be done.
Comment 9•3 years ago
•
|
||
Luca, Shane, Andreas and I met, and we decided to require permissions for privileged features (and re-use mozillaAddons
when a feature does not need its own dedicated permission). A benefit of enforcing this in Firefox is the reduction of non-obvious exposed abilities associated with privileged signatures. The allowed private browsing feature won't be tied to permissions, it'll still be tied to the isPrivileged flag.
The goal is to do this before the next ESR.
Updated•3 years ago
|
Comment 10•3 years ago
|
||
I'm marking this as dependent on bug 1734987 since the work there simplifies the implementation of parsing and ignoring/warning about the use of privileged stuff.
Reporter | ||
Comment 11•3 years ago
|
||
I put an overview of the currently active privileged extensions for examination into a spreadsheet.
Assignee | ||
Comment 12•3 years ago
|
||
I've talked through this again with Luca. We will add a new permission, "privilegedAddon". In firefox this will essentially do nothing. The pipeline will need to enforce that all new signing requires this permission. Then AMO can also require it, and fail if any other privileged permission exists without it.
Assignee | ||
Comment 13•3 years ago
|
||
Updated•3 years ago
|
Reporter | ||
Comment 14•3 years ago
•
|
||
(In reply to Shane Caraveo (:mixedpuppy) from comment #12)
I've talked through this again with Luca. We will add a new permission, "privilegedAddon". In firefox this will essentially do nothing. The pipeline will need to enforce that all new signing requires this permission. Then AMO can also require it, and fail if any other privileged permission exists without it.
Why can't we gate privileged features on that permission in Firefox? The downside of it doing nothing is that the add-on will work just fine in Firefox during development without it, so they don't know they need to add it. Then, they'll either submit to AMO which will accept and sign it, only for end-users to notice it's broken, or they will realize it needs to go through shipit, at which point shipit will deny the submission because the permission is missing. This sounds like a bad experience to me in either case.
Assignee | ||
Comment 15•3 years ago
|
||
Comment 16•3 years ago
|
||
Linked as a "see also" the github isssue filed in the add-ons linter to track the changes that will be necessary on the addons-linter side.
Comment 17•3 years ago
|
||
This patch includes only the subset of D145687 changes related to the reworked JSONSchema data, plus some minor changes to Schemas.jsm to take the new
JSONSchema type ("PrivilegedPermissions") and the new custom JSONSchema keyword (the boolean "privileged" property used to identify manifest fields
only allowed in privileged extensions).
Besides the changes to the schema data, this patch is not expected to introduce any difference in behavior and so it could also land on its own
if needed (and the rest of the changes landed separately).
Updated•3 years ago
|
Updated•3 years ago
|
Comment 18•3 years ago
|
||
Comment 19•3 years ago
|
||
Backed out changeset d3577f741ef5 (Bug 1739114) for causing xpcshell failures on test_ext_permissions.js.
Backout link
Push with failures <--> X3
Failure Log
Updated•3 years ago
|
Comment 20•3 years ago
|
||
As I suspected after taking a look to the failure message, there was a one line change to test_ext_permissions.js that was still in the second patch while I should have moved it in the first one (along with the related JSONSchema data changes).
I've just updated the two patches to move that small change into the right patch.
I'm going to push the first patch to autoland again in a few minutes.
Comment 21•3 years ago
|
||
Comment 22•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 23•3 years ago
|
||
Comment 24•3 years ago
|
||
bugherder |
Comment 25•3 years ago
|
||
Updated•3 years ago
|
Comment 26•3 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/b0e5130a7478
Port to TB: Enforce addon privilege during manifest parsing for access to privileged features from temporarily installed addons. r=mkmelin
Updated•3 years ago
|
Updated•3 years ago
|
Comment 27•3 years ago
|
||
Is this change supposed to break theme_experiments
?
Comment 28•3 years ago
|
||
(In reply to matthias koplenig [:metasieben] from comment #27)
Is this change supposed to break
theme_experiments
?
theme_experiments
should still be allowed for permanently installed privileged extensions and for development purpose to temporarily installed extensions while "extensions.experiments.enabled" is also set to true
(those are both cases that are officially supported, and so they are also covered by automated tests).
may I ask you if you could provide some more context so that I can investigate it?
if you could provide the steps to reproduce and a test extension that we could use to reproduce the issue as you are experiencing it, that would make it investigating the potential change in behavior even quicker.
Thanks in advance for your help!
Comment 29•3 years ago
|
||
Thank you for clarifying the change.
The "use-case" I was wondering about:
Up until now you could disable signing and permanently install a theme with a theme_experiment
property.
Comment 30•3 years ago
|
||
(In reply to matthias koplenig [:metasieben] from comment #29)
Thank you for clarifying the change.
The "use-case" I was wondering about:
Up until now you could disable signing and permanently install a theme with atheme_experiment
property.
Thanks a lot for reporting it to us quickly, very much appreciated!
I filed Bug 1773076 to track following up on that.
Updated•3 years ago
|
Description
•