GeckoWebExecutor.fetch sometimes rejects http/https URLs as invalid
Categories
(GeckoView :: General, defect, P1)
Tracking
(Not tracked)
People
(Reporter: csadilek, Assigned: agi)
References
Details
(Whiteboard: [geckoview:m87])
Attachments
(2 files)
We see valid URLs being rejected due to "Unsupported URI scheme":
https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoWebExecutor.java#142
We see two cases of this in Fenix:
- For icons where we check the URL scheme is http or https
- For addon collections where the URL is configured as part of the build and definitely https
One problem here is the use of toLowerCase without specifying a locale (e.g. Locale.ROOT) which will fallback to the device locale and can have surprising results. However, I wasn't able to reproduce this.
| Assignee | ||
Comment 1•5 years ago
|
||
Let's see if Bug 1686809 helps.
| Assignee | ||
Comment 2•5 years ago
|
||
We landed the patch to change toLowerCase did this bug go away?
| Reporter | ||
Comment 3•5 years ago
|
||
Unfortunately, no, we still see this happening for http urls we pass down to GeckoWebExecutor.fetch. This also happens for urls that are configured as part of the build e.g. the AMO endpoint to fetch collections.
But even for icons, we check if the url starts with http before we pass it down. So, it's strange that somehow the regex in GV doesn't find a match.
| Reporter | ||
Comment 4•5 years ago
|
||
For Icons:
Sentry: https://sentry.prod.mozaws.net/operations/firefox/issues/9276162/
Our logic to check URL before fetching: https://github.com/mozilla-mobile/android-components/blob/master/components/browser/icons/src/main/java/mozilla/components/browser/icons/loader/HttpIconLoader.kt#L81 (checks if scheme is "http" or "https" which must pass before we fetch)
For AMO collection endpoint:
Sentry: https://sentry.prod.mozaws.net/operations/firefox-nightly/issues/9682088/ (it's suspicious that this one only happens in Nightly where we allow custom collection IDs but this shouldn't affect the URI scheme).
| Assignee | ||
Comment 5•5 years ago
|
||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 8•5 years ago
|
||
Copying from slack:
ok I got it
uri.matches("(http|blob).") matches the full uri string
. matches everything... except a newline chracter
so if the URL contains a new line character anywhere the uri.matches fails regardless of what it starts with
what I'm suspecting is happening is users are copying the collection name which sometimes happens to contain a new line
I tested it if I add a new line at the end of the collection name I get that error
| Assignee | ||
Comment 9•5 years ago
|
||
The harmless looking regex
uri.matches("(http|blob).*")
has a flaw: it will not accept URLs that contain a new line character. In that
case GeckoWebExecutor errors out with "Unsupported URI scheme." when in reality
that's not the problem at all.
Since it has caused a bunch of headaches to the frontend already, let's just
replace that regex with a plain startsWith which should work in all cases.
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
| bugherder | ||
Updated•5 years ago
|
| Assignee | ||
Comment 12•5 years ago
|
||
Looks like the patch in Comment #9 worked, the crashes are gone 🥳
Updated•2 years ago
|
Description
•