Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce sandbox on all spawned BrowserWindow objects #91

Merged
merged 1 commit into from
May 27, 2020

Conversation

turt2live
Copy link
Member

The docs (https://www.atom.pe/docs/api/sandbox-option/) say we should be using the browser-native window.open implementation, but in practice that appears very much false. Electron, no matter our set of options, appears to always make a hit to the ipcRenderer with window.open calls, causing the calling code to explode due to the sandbox making that impossible.

By using app.enableSandbox(), it puts the sandbox in place over all BrowserWindow objects, including the temporary ones which empirically are being created for window.open. We do not need to specify sandbox: true to the BrowserWindow with this approach, though uncommenting and therefore reintroducing the flag causes our lovely ipcRenderer error again.

As far as I can tell, the sandbox does actually get applied to the window though the fact that sandbox: true still does things despite the docs saying otherwise leaves me a bit uncomfortable.

Fixes element-hq/element-web#13719

The docs (https://www.atom.pe/docs/api/sandbox-option/) say we should be using the browser-native `window.open` implementation, but in practice that appears very much false. Electron, no matter our set of options, appears to always make a hit to the ipcRenderer with `window.open` calls, causing the calling code to explode due to the sandbox making that impossible.

By using `app.enableSandbox()`, it puts the sandbox in place over all BrowserWindow objects, including the temporary ones which empirically are being created for `window.open`. We do not need to specify `sandbox: true` to the BrowserWindow with this approach, though uncommenting and therefore reintroducing the flag causes our lovely ipcRenderer error again.

As far as I can tell, the sandbox does actually get applied to the window though the fact that `sandbox: true` still does things despite the docs saying otherwise leaves me a bit uncomfortable.

Fixes element-hq/element-web#13719
@turt2live turt2live requested a review from a team May 20, 2020 22:17
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, although I'd feel better if we left the sandbox option on the webPreferences too until app. enableSandbox() was no longer experimental.

@turt2live
Copy link
Member Author

Looks good, although I'd feel better if we left the sandbox option on the webPreferences too until app. enableSandbox() was no longer experimental.

We can't, for the reasons described within the PR. It makes angry noises.

@turt2live turt2live requested a review from dbkr May 25, 2020 04:51
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see - sigh

@turt2live turt2live merged commit d33ce95 into develop May 27, 2020
@turt2live turt2live deleted the travis/ipc-renderer branch May 27, 2020 16:03
@Dominara1
Copy link

This change made issues arise for me on my local root-only devices. Even while using --no-sandbox, it would spam the terminal with errors telling me to use --no-sandbox to run the application. I reverted the changes mentioned & it started to work just fine. I recommend doing so for people such as myself who prefer not to use a user account on certain devices.

@turt2live
Copy link
Member Author

I don't think reverting this will have the intended effect, but if you're running into issues then please open a new issue rather than commenting on a 2 year old PR :(

@element-hq element-hq locked as resolved and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSO Fallback does not work on Riot-desktop
3 participants