Open Bug 1758306 Opened 4 years ago Updated 2 months ago

Handle <all_urls> used as an API permissions in MV3 properly

Categories

(WebExtensions :: General, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: zombie, Assigned: zombie, NeedInfo)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [addons-jira])

Unfortunately, we treat <all_urls> as an API permission as well, and those cases will need special handling for bug 1745818.

No longer blocks: 1745818
Depends on: 1745818
Assignee: nobody → tomica
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [addons-jira]
Blocks: 1711787

It seems we only have a few uses of <all_urls> as an API permission left:

https://searchfox.org/mozilla-central/search?q=all_urlsPermission
https://searchfox.org/mozilla-central/search?q=all_urls&path=components%2Fextensions%2Fschemas

I plan to stop adding it to the api permissions, and instead change the existing checks to origin permissions checks.

Other uses:

I think that it's fine to drop the first and third use of <all_urls>, and at most keep the second for extension documents (not content scripts given the efforts at bug 1578405).

Why is it fine to drop canvas support?

Flags: needinfo?(rob)
Blocks: 1957794

Note: bug 1957794 has an extension that is most likely affected by this.

At install time, we fix up MV2 <all_urls> permissions at https://searchfox.org/mozilla-central/rev/d602f8558872d133dc9240a01cd25d0898c58e5a/toolkit/components/extensions/Extension.sys.mjs#1921-1923

In MV3, we skip that logic at first, but add origins in _setupStartupPermissions at https://searchfox.org/mozilla-central/rev/d602f8558872d133dc9240a01cd25d0898c58e5a/toolkit/components/extensions/Extension.sys.mjs#3965-3979 . Notably, the special <all_urls> check + addition is missing.

When an optional permission is toggled (whether via about:addons UI or the permissions API), it is added/removed via https://searchfox.org/mozilla-central/rev/d602f8558872d133dc9240a01cd25d0898c58e5a/toolkit/components/extensions/ExtensionPermissions.sys.mjs#415-423

Tom, do you still plan to fix this bug as proposed (replacing use of all_urls API permission with a host permission check), or would the simpler approach of adding <all_urls> from _setupStartupPermissions be acceptable in your opinion?

Flags: needinfo?(tomica)
Blocks: 2014047
You need to log in before you can comment on or make changes to this bug.