Closed Bug 1673763 Opened 4 years ago Closed 1 year ago

[gv-junit-fis] Error page triggers `about:blank` onLocationChange with Fission

Categories

(GeckoView Graveyard :: Sandboxing, defect, P1)

Unspecified
All

Tracking

(firefox117 wontfix, firefox118 fixed)

RESOLVED FIXED
118 Branch
Tracking Status
firefox117 --- wontfix
firefox118 --- fixed

People

(Reporter: agi, Assigned: owlish)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116][geckoview:m117][fxdroid])

Attachments

(2 files, 1 obsolete file)

To reproduce this run NavigationDelegateTest#loadFileNotFound with fission enabled.

Priority: -- → P2
Severity: -- → S3
Fission Milestone: --- → Future

Tracking this bug for Android Fission milestone M2 (pass tests with Fission enabled).

Whiteboard: [fission:android:m2]
Fission Milestone: Future → ---
Whiteboard: [fission:android:m2] → [fission:android:m2] [geckoview:2022q3?]
Whiteboard: [fission:android:m2] [geckoview:2022q3?] → [fission:android:m2] [geckoview:2022q3]

Nika thinks this is a problem with the process switch happening, error pages don't expect to load anything different than about:neterror while we use either a resource:// or a data URI which might trigger an unexpected process switch. We will have to work with platform to make this work for Android somehow.

Flags: needinfo?(nika)

I'm not sure this is a good approach long term, but we may be able to check if this is the cause by hacking away the process switch when loading error pages.

To do that, we'd add an extra case to IsolationOptionsForNavigation which takes into account the mLoadStateLoadType when calculating behavior, probably something like this around here.

#ifdef MOZ_WIDGET_ANDROID
  // If we're loading an error page on android, it must complete within the same process as the
  // errored page load would complete in due to code expecting that behavior. See bug 1673763.
  if (aLoadStateLoadType == LOAD_ERROR_PAGE) {
    // XXX: Validate that this URI is OK to load as an error page somehow? It will bypass site isolation.
    // Log an error and return `Err(NS_ERROR_DOM_SECURITY_ERR)` or similar to abort and reject the load if it isn't valid.
    // Should probably at least require it to be bundled into the browser (i.e. `resource://` URI?)?

    MOZ_LOG(gProcessIsolationLog, LogLevel::Verbose,
            ("Forcing error page load to complete in the current process"));
    behavior = IsolationBehavior::Anywhere;
  }
#endif
Flags: needinfo?(nika)

Moving Android Fission bugs to the new GeckoView::Sandboxing component.

Component: General → Sandboxing
Summary: Error page triggers `about:blank` onLocationChange with Fission → [gv-junit-fis] Error page triggers `about:blank` onLocationChange with Fission
Assignee: nobody → bugzeeeeee
Priority: P2 → P1
Whiteboard: [fission:android:m2] [geckoview:2022q3] → [fission:android:m2] [geckoview:2022q3][geckoview:m114]
Whiteboard: [fission:android:m2] [geckoview:2022q3][geckoview:m114] → [fission:android:m2] [geckoview:2022q3][geckoview:m115]

The tests affected by this:

  • NavigationDelegateTest#loadFileNotFound
  • NavigationDelegateTest#loadUnknownHost
  • NavigationDelegateTest#loadExternalDenied
  • NavigationDelegateTest#loadUntrusted
  • NavigationDelegateTest#loadDeprecatedTls
  • NavigationDelegateTest#safebrowsingPhishing
  • NavigationDelegateTest#safebrowsingMalware
  • NavigationDelegateTest#safebrowsingUnwanted
  • NavigationDelegateTest#safebrowsingHarmful
Whiteboard: [fission:android:m2] [geckoview:2022q3][geckoview:m115] → [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116]
Duplicate of this bug: 1827321
Whiteboard: [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116] → [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116][geckoview:m117]
Attachment #9344748 - Attachment is obsolete: true
Attachment #9344748 - Attachment is obsolete: false
Attachment #9344748 - Attachment is obsolete: true

We investigated the issue and discovered that on Fission, when we load an error page on Android, we have a process switch which leads to about:blank load instead of the error page. It's important to note that on Android, we don't have standard about: error pages like on desktop, the app is expected to provide their own custom error pages.

One solution is to just not have a process switch when we load an error page on Android. It seems simple but less secure (although secure enough, as the error page URL come from the app itself via API).

Another option is to load the error pages in parent process. We would achieve that by loading a special about: address, and then in the AboutRedirector intercept that, call the GV API to ask the app for the URI, and initialize the page with that URI (the sketch of this solution can be found in the abandoned WIP patch for this bug). Because we get the URI from GV asynchronously, we need to do the redirect also asynchronously. For that, we will need to write a custom channel. It is a lot of work 🤔 But it is a more solid and more secure solution.

For now, we decided to solve the problem in a simple way to move on to the rest of the bugs because at the moment we don't know what we will discover there. After we fixed the tests, it would be nice to revisit this and add the custom channel. I will create a separate bug for that work as a clone of this one.

Blocks: 1848701
No longer blocks: 1848701
See Also: → 1848701
Pushed by istorozhko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6fa80c1f2f66 Do not switch processes when loading error pages on Android r=geckoview-reviewers,nika,jonalmeida
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch

Reopening to enable the rest of the tests. I was so concentrated on the one that is in the STR, that I forgot about the others - there are quite a few of the tests that were blocked by this.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by istorozhko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/df174956d60e Enable more tests; make sure the comments for disabled tests are accurate r=geckoview-reviewers,boek
Status: REOPENED → RESOLVED
Closed: 1 year ago1 year ago
Resolution: --- → FIXED
Whiteboard: [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116][geckoview:m117] → [fission:android:m2] [geckoview:2022q3][geckoview:m115][geckoview:m116][geckoview:m117][fxdroid]
Blocks: 1849389
Regressions: 1853282
Product: GeckoView → GeckoView Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: