With Firefox 153 making file access opt-in (here), I’ve been thinking about how extensions should handle this.
Currently, browser.permissions.request() works fine for requesting host permissions like "<all_urls>" at runtime, which triggers the “Access your data for all websites” prompt.
What I haven’t been able to confirm is whether the same approach works for file:///*:
From what I can tell, this does not work - Firefox doesn’t prompt the user the way it does for web origins. The permission appears to be a separate class of access, not just another origin pattern.
So my questions are:
Is file:///* explicitly excluded from browser.permissions.request()? Is that documented somewhere I missed?
Is there any current workaround to request local file access at runtime?
Are there plans to let the extension trigger a “Access local files on your computer” prompt dynamically, the same way host permissions work?
Right now it feels like file access is a second-class citizen compared to web host permissions in that regard.
Spot on. Local filesystem access is now in a different class of permissions. The other major capability with this kind of restriction is the ability to “Run in Private Windows”, which is also gated behind a control in the about:addons page. Here’s the support page for that feature: Client Challenge.
It may also be worth noting that Chrome also requires users to manually opt into granting an extension access to file:/// URLs.
Chrome has some information about it in their Declare permissions docs. I’m not seeing much mention of “file:/// URL” or “file scheme” on MDN at the moment. Maybe file an issue on Issues · mdn/content · GitHub?
I’m not aware of any. The way Chrome extension developers normally work around this is to either users with instructions either in-app or on a support site.
I’m just a community member, but I’m not aware of any such plans. I just asked on the #addons:mozilla.orgMatrix room to double check.