Skip to content

feat: enable sandbox by default - #28496

Closed
nornagon wants to merge 4 commits into
mainfrom
sandbox-by-default
Closed

nornagon wants to merge 4 commits into
mainfrom
sandbox-by-default

Conversation

@nornagon

@nornagon nornagon commented Apr 2, 2021

Copy link
Copy Markdown
Contributor

Description of Change

Closes #28466.

This enables sandbox: true by default unless nodeIntegration: true is
specified. This is a non-breaking change because without nodeIntegration: true, there's no documented way to perform any action that would cause
different behavior depending on whether the sandbox is enabled or not.

Checklist

Release Notes

Notes: Renderer processes without node integration enabled are now sandboxed by default.

@nornagon nornagon added semver/patch backwards-compatible bug fixes target/13-x-y labels Apr 2, 2021
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Apr 2, 2021

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is most definitely a breaking change, nodeIntegration: false still has NodeJS in preload scripts. Defaulting to sandbox: true will break preload script that utilize node.js

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Apr 3, 2021
@nornagon nornagon added wip ⚒ semver/major incompatible API changes and removed target/13-x-y semver/patch backwards-compatible bug fixes labels Apr 22, 2021
@nornagon

Copy link
Copy Markdown
Contributor Author

@MarshallOfSound do you have thoughts about how we can approach making this the default?

perhaps a phased deprecation:

  1. If preload is empty and nodeIntegration is false or unspecified, enable sandbox by default.
  2. If preload is non-null and nodeIntegration is false or unspecified, and sandbox is unspecified, warn that the default will be changing.
  3. Enable sandbox by default when nodeIntegration is false or unspecified (i.e. this PR)

@MarshallOfSound

Copy link
Copy Markdown
Member

If preload is empty and nodeIntegration is false or unspecified, enable sandbox by default.

I think you also have to care about nodeIntegrationInSubFrames and nodeIntegrationInWorkers too, in general I think those three steps if sufficiently documented are a viable path to enabling sandbox by default.

@nornagon

Copy link
Copy Markdown
Contributor Author

Is it the case that nodeIntegrationIn(SubFrames|Workers): true w/o nodeIntegration: true has an effect? that seems odd, that you'd be able to enable node integration in subframes/workers without it being enabled in the main frame, but uh, if so, then sure.

@nornagon
nornagon marked this pull request as draft July 19, 2021 20:12
@nornagon

Copy link
Copy Markdown
Contributor Author

Closing in favor of #30197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Enable sandbox: true by default for BrowserWindow

2 participants