Closed
Bug 1416146
Opened 7 years ago
Closed 7 years ago
redirect from https(s) to extension URL is broken
Categories
(WebExtensions :: Request Handling, defect, P3)
WebExtensions
Request Handling
Tracking
(firefox57 wontfix)
RESOLVED
WONTFIX
Tracking | Status | |
---|---|---|
firefox57 | --- | wontfix |
People
(Reporter: dietrich, Unassigned)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete)
I'm helping a Chrome extension migrate, and they reported this as not working.
I'm waiting for more info, but sounds like it's here:
https://github.com/blockadeio/firefox_extension/blob/master/extension/resources/js/core/background.js#L90
Will make a reduced testcase and test out locally.
Reporter | ||
Comment 1•7 years ago
|
||
No notes in the docs specifically about redirects to extension URLs.
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/BlockingResponse
However, there is a note about non-HTTP schemes generally, pointing to bug 707624, which is about lack of e10s support for redirecting to data URIs.
I asked there about whether that applies in this case also.
Reporter | ||
Comment 2•7 years ago
|
||
Hi Andy! Is this a known issue? Can we bump priority as it's a Chrome compat problem preventing functional migrations?
Flags: needinfo?(amckay)
Comment 3•7 years ago
|
||
This is probably a bit of a stretch but bug 1149250 might help here. Other than that, sorry this isn't likely to be on our radar soon.
status-firefox57:
--- → wontfix
Component: WebExtensions: General → WebExtensions: Request Handling
Flags: needinfo?(amckay)
Priority: -- → P3
Reporter | ||
Updated•7 years ago
|
Blocks: webextensions-chrome-gaps
Reporter | ||
Comment 4•7 years ago
|
||
I dug into this, and it seems this is actually supposed to work, was implemented by Shane in bug 1416146.
See Honza's comment here: https://bugzilla.mozilla.org/show_bug.cgi?id=707624#c11.
Flags: needinfo?(mixedpuppy)
Keywords: regression
Comment 5•7 years ago
|
||
It's not possible to redirect a request to an extension resource that isn't listed in its manifest's "web_accessible_resources" section.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 6•7 years ago
|
||
(In reply to Kris Maglione [:kmag] (long backlog; ping on IRC if you're blocked) from comment #5)
> It's not possible to redirect a request to an extension resource that isn't
> listed in its manifest's "web_accessible_resources" section.
Can you clarify? The extension needs to list the moz-ext URL in the manifest? Can you link the docs for it?
Is this different from Chrome's implementation?
Flags: needinfo?(kmaglione+bmo)
Reporter | ||
Comment 7•7 years ago
|
||
The way they have it works fine for Chrome, so re-opening until we can confirm what exactly our different behavior is, and why. And whether or not we need a new bug for parity.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Comment 8•7 years ago
|
||
Chrome may not (per comment 7) require a web accessible resource when an extension redirects to itself. For Firefox, the security context of the loading document wont allow for a redirect from a public url to a web-ext url without the web-ext url being listed in the manifest. The check happens here:
https://searchfox.org/mozilla-central/source/netwerk/protocol/res/ExtensionProtocolHandler.cpp#369
If we wanted to change this, we'd probably have to do some changes in nsHttpChannel to have a way to create internal redirects, but I haven't really thought it through.
Using web_accessible_resources would work for both Chrome and Firefox.
Flags: needinfo?(mixedpuppy)
Updated•7 years ago
|
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Flags: needinfo?(kmaglione+bmo)
Resolution: --- → INVALID
Comment 9•7 years ago
|
||
I don't think this is a regression as much as it is a minor incompatibility that has a compatible solution. We should document it under both WebRequest[1] and web_accessible_resources. Something along the lines of "If an extension wants to redirect a public url to an extension url, the extension url must be listed in the manifest under 'web_accessible_resources'".
[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest
Comment 10•7 years ago
|
||
closing, dev-doc will pick up later.
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → WONTFIX
Reporter | ||
Comment 11•7 years ago
|
||
Ok, great - thanks very much for clarifying what's happening here Shane, and why it's not working for people porting their extensions to Firefox.
If there's a guide for porting Chrome extensions to Firefox, should also be documented there.
If there's not a security reason why the behavior is different, then should I open a new bug for supporting this functionality? I'm not sure what possible upside there is for needlessly making it harder for Chrome extensions to work seamlessly in Firefox.
Flags: needinfo?(mixedpuppy)
Comment 12•7 years ago
|
||
I don't feel like its necessary since there is a compatible work around, but I'd personally be fine allowing an extension to redirect to its own urls without the url listing in the manifest. I've a feeling fixing this is not trivial. I don't recall any method by which we track where and how a redirect is created, so we'd have no way to tie back to the responsible party when we do the security checks. You might ping mayhemer and see if he thinks this is simple or not.
Flags: needinfo?(mixedpuppy)
Comment 13•7 years ago
|
||
I've scattered a few reference to this:
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#webRequest
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest#Chrome_incompatibilities (included from the "Chrome incompatibilities" page)
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onBeforeRequest
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/BlockingResponse
* https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/web_accessible_resources
...let me know if this covers it.
Flags: needinfo?(mixedpuppy)
Comment 14•7 years ago
|
||
(In reply to Will Bamberg [:wbamberg] from comment #13)
> I've scattered a few reference to this:
>
> *
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/
> Chrome_incompatibilities#webRequest
It should also be noted that any website may then link/redirect/etc to that url, and extensions should handle external input in a secure manor.
> *
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/
> web_accessible_resources
I think this page should probably have some kind of section on security implications of having a web_accessible_resources page. Basically any accessible resource needs to treat any get/post/etc data as it would from any untrusted source, as if it were a page on a webserver somewhere.
Flags: needinfo?(mixedpuppy)
Updated•6 years ago
|
Product: Toolkit → WebExtensions
Comment 15•5 years ago
|
||
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•