electron / electron/electron

Fuse to disable all Node.js flags

Open
#49,855 0 comments 0 reactions 0 assignees View on GitHub
enhancement :sparkles: security 🔒
Dominant language
C++
Stars
123k
Forks
17.5k
Avg merge
14h 28m
Merged PRs (30d)
870

Description

### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

For security purposes, we should have a fuse to disable all Node.js flags in production applications.

The more [Node.js flags](https://www.electronjs.org/docs/latest/api/command-line-switches#nodejs-flags) we expose, the higher the risk. In production apps, you'd usually want to disable all Node.js flags anyways.

### Proposed Solution

Add a fuse to disable all Node.js flags.

Similar to the [`nodeCliInspect` fuse](https://www.electronjs.org/docs/latest/tutorial/fuses#nodecliinspect), but for _all_ handling of Node.js flags.

Implementation idea: make [`IsAllowedOption`](https://github.com/electron/electron/blob/8b057176618af9a47afed2a2e869932ebfc9093f/shell/common/node_bindings.cc#L404) always return false when the fuse is flipped.

### Alternatives Considered

- Not adding any Node.js flags to Electron at all. However, those flags can make development easier.
- Changing the existing `nodeCliInspect` fuse.

### Additional Information

Idea from https://github.com/electron/electron/pull/49711#pullrequestreview-3822516057.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.