Open Bug 1766752 Opened 2 years ago Updated 3 months ago

granted_host_permissions does not automatically grant permissions in content_scripts

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

The granted_host_permissions manifest key for unit tests is used to grant all permissions upfront, to revert the permission behavior of MV3 to MV2 (i.e. treat all permissions as mandatory instead of optional).

This logic only includes the items from host_permissions (and permissions, but that doesn't contain origins in MV3): https://searchfox.org/mozilla-central/rev/2e328e8040a4b4419647aabdc536a3f61bafc384/toolkit/components/extensions/Extension.jsm#1211-1213,1227-1231

Since bug 1745819, content script execution of MV3 extensions requires approved manifest permissions, due to https://searchfox.org/mozilla-central/rev/2e328e8040a4b4419647aabdc536a3f61bafc384/toolkit/components/extensions/WebExtensionPolicy.cpp#695-697.

Because the patterns from content_scripts are not added to originPermissions, static content scripts will still not execute despite setting granted_host_permissions to true.

A work-around to this to get tests to run is to duplicate the origin part of the matches key in the host_permissions key of the manifest.

granted_host_permissions was introduced in bug 1745818.

See Also: → 1745818

The severity field is not set for this bug.
:mixedpuppy, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mixedpuppy)

granted_host_permissions is only meant for privileged extensions and temporary loaded for testing, both of those could (and likely would already) use <all_urls> in host_permissions to work around the limitation.

Blocks: 1711787
Severity: -- → S4
Priority: -- → P3
Whiteboard: [addons-jira]
Flags: needinfo?(mixedpuppy)
You need to log in before you can comment on or make changes to this bug.