Skip to content

fix: use appropriate site instance for cross-site nav's (backport: 4-0-x) - #15969

Merged
codebytere merged 2 commits into
electron:4-0-xfrom
ppontes:ppontes/8100-backport-fix-to-4-0-x
Dec 10, 2018
Merged

codebytere merged 2 commits into
electron:4-0-xfrom
ppontes:ppontes/8100-backport-fix-to-4-0-x

Conversation

@ppontes

@ppontes ppontes commented Dec 6, 2018

Copy link
Copy Markdown
Member

Description of Change

This is a backport of the fix merged to master: d5d1fa8.

When a window is opened with window.open to navigate to a cross-site destination, the new site instance should belong to the browsing instance of the opener window in order not to break scripting relationships between windows.

fixes #8100.

This change turns Chromium's site isolation on and depends on it being on in order to work properly. Turning on site isolation revealed the following latent problems that are / will be fixed also in this PR:

  • If a cross-site redirection happens during a navigation, the renderer process that will handle the final URL will be locked to the pre-redirection URL with Chromium's child process security. If the page tries to access local resources, Chromium will refuse and kill the renderer process.
  • Chromium now kills renderer processes that attempt to access resources for which they have no permissions. This means that the "custom non standard schemes cannot access localStorage" UT had to be adapted.

The fix also requires the following to be addressed:

  • If a cross-site redirection happens during a navigation, Chromium discards the speculative RFH that was created for the pre-redirection URL. This is harmless in Chromium but Electron reacts by asynchronously closing the associated BrowserWindow. User sees the new window navigating to the final URL and then being closed.

Checklist

Release Notes

Notes: Fixed a bug where window.opener of a window created with window.open from a sandboxed renderer was null.

@ppontes
ppontes requested a review from a team December 6, 2018 10:06
@ppontes ppontes changed the title Ppontes/8100 backport fix to 4 0 x fix: use appropriate site instance for cross-site nav's (backport: 4-0-x) Dec 6, 2018
@ppontes ppontes added the 4-2-x label Dec 6, 2018
@ppontes
ppontes requested a review from deepak1556 December 6, 2018 10:10
@deepak1556
deepak1556 requested a review from ckerr December 6, 2018 13:55
@ppontes

ppontes commented Dec 7, 2018 •

Copy link
Copy Markdown
Member Author

@ckerr @MarshallOfSound , can you please check and merge this PR if you approve it? We'd like to have as much beta exposure to this fix as possible. Thanks! The failing mac ut's seem to be the usual flakes.

@codebytere
codebytere merged commit 3021870 into electron:4-0-x Dec 10, 2018
@release-clerk

release-clerk Bot commented Dec 10, 2018

Copy link
Copy Markdown

Release Notes Persisted

Fixed a bug where window.opener of a window created with window.open from a sandboxed renderer was null.

@codebytere

codebytere commented Dec 10, 2018 •

Copy link
Copy Markdown
Member

REVERT for pre-emptive merge: #15995

codebytere added a commit that referenced this pull request Dec 10, 2018
@ppontes
ppontes deleted the ppontes/8100-backport-fix-to-4-0-x branch December 20, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants