Skip to content

Disallow permission requests by default #12931

Open

Description

@sindresorhus

Is your feature request related to a problem? Please describe.

Electron is known for being insecure. It should come with better security defaults.

Describe the solution you'd like

The Electron security checklist recommends disallowing permission requests for features the app doesn't need. It's a big security gap that this is opt-out rather than opt-in.

I recommend making all permission requests denied by default and let the user instead explicitly opt into what they need. That's also how Chrome works.

So the default would become something like this:

const {session} = require('electron');

session.defaultSession.setPermissionRequestHandler((webContents, permission, callback) => {
	callback(false);
});

Activity

  1. self-assigned this
    on Oct 23, 2019
  2. b-zurg commented on Jul 23, 2020

    @b-zurg

    It sort of shows the mentality of making the framework as easy to use as possible. It's not a good one. Security should be first priority and then ease of use. I second this and was equally surprised when I saw this note in the docs:

    By default, Electron will automatically approve all permission requests unless the developer has manually configured a custom handler. While a solid default, security-conscious developers might want to assume the very opposite.
    

    We're disagreeing with the notion that this is "a solid default".

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions