Add support for `restrictSchemes` in `registerContentScripts()` (MV2)
Categories
(WebExtensions :: General, enhancement, P4)
Tracking
(firefox104 fixed)
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: willdurand, Assigned: willdurand)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
We use parseMatchPatterns
to validate the matches
option in scripting.registerContentScripts()
. We should configure the restrictSchemes
option (depending on extension.restrictSchemes
?) and add test coverage for that.
Given this would allow "privileged callers to run scripts literally anywhere", it is low priority.
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Updated•2 years ago
|
Comment 2•2 years ago
|
||
The patch above introduces support for restrictSchemes
in the scripting API, but that only works in MV2, because the optional permission mechanism lacks restrictSchemes
flags in various places (which is required in MV3, whereas MV2 extensions also have the option of using mandatory host permissions, where restrictSchemes
is supported)).
In order to meaningfully support restrictSchemes
in the scripting
API with MV3, we'd also need to set the flags where instances of MatchPattern
(including MatchPatternSet
constructors with string input) are created.
- The optional permission backend (
ExtensionPermissions.add
andExtensionPermissions.remove
)- https://searchfox.org/mozilla-central/rev/32ca4fc265150e7d3d7aa6c6abea088768cf024b/toolkit/components/extensions/ExtensionPermissions.jsm#328,368
- The users of the ExtensionPermissions module should be prepared to receive origins that contain schemes outside of the standard set of supported schemes.
- For example, if a privileged extension is upgraded to a version that is not privileged any more, then the optional permission backend may still yield privileged host permissions, which could break callers that pass the origin to
MatchPattern
withoutrestrictSchemes: false
. - Part of that effort could be combined with fixing bug 1766915.
- For example, if a privileged extension is upgraded to a version that is not privileged any more, then the optional permission backend may still yield privileged host permissions, which could break callers that pass the origin to
permissions.request
permissions.contains
about:addons
UI to control it
Comment 3•2 years ago
|
||
Any host permissions outside of permitted schemes[1] should not be included in about:addons and should not be contained in ExtensionPermissions. They should be granted automatically at extension startup. These are privileged extensions and are primarily going to be using urls internal to firefox. They'll have internal needs for those in order to operate, we shouldn't extend user control to those.
Given that, I think that a) it doesn't matter that it's MV2 only right now, and b) a followup bug should be filed to grant permission for privileged schemes here[2].
[1] https://searchfox.org/mozilla-central/rev/ffb50da3ca89100b6ae5054cfe69c187679515f0/toolkit/components/extensions/MatchPattern.cpp#227-228
[2] https://searchfox.org/mozilla-central/rev/ffb50da3ca89100b6ae5054cfe69c187679515f0/toolkit/components/extensions/Extension.jsm#1319-1321
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 5•2 years ago
|
||
(In reply to Shane Caraveo (:mixedpuppy) from comment #3)
They'll have internal needs for those in order to operate, we shouldn't extend user control to those.
I've came to the same conclusion as well.
Comment 6•2 years ago
|
||
bugherder |
Description
•