Skip to content

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

@molant

Description

@molant

Preflight Checklist

Problem Description

Since Electron v5 the default behavior of BrowserWindow is to create it with nodeIntegration: false. In v12 contextIsolation was turned on as well (see #23506). Another default that Electron should have is sandbox: true.

Proposed Solution

I'd like the defaults of creating a new BrowserWindow to be equivalent to the following:

const mainWindow = new BrowserWindow({
  webPreferences: {
    nodeIntegration: false,
    contextIsolation: true,
    sandbox: true
  }
);

Alternatives Considered

No alternatives considered. As @MarshallOfSound said in #23506:

We're making this change to improve the default security of Electron apps so that your app is only insecure if you have deliberately opted in to the insecure behaviour.

Additional Information

Happy to dig and try to find any data needed to make a decission.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions