Repository navigation
process: initial impl of feature access control #22112
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
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
cli: add flags for access control
Add `--disable=featureA,featureB,...` and `--experimental-access-control` flags that control (and enable) `process.accessControl` at startup.
- Loading branch information
commit b47f3ebda0d9211308c7aebaedc99bc9a906fd0b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| 'use strict'; | ||
| require('../common'); | ||
| const assert = require('assert'); | ||
| const { spawnSync } = require('child_process'); | ||
|
|
||
| assert.strictEqual( | ||
| spawnSync(process.execPath, ['-p', 'process.accessControl']) | ||
| .stdout.toString().trim(), 'undefined'); | ||
|
|
||
| { | ||
| const { stdout, stderr } = spawnSync( | ||
| process.execPath, | ||
| ['--experimental-access-control', '-p', 'process.accessControl.apply']); | ||
| assert.strictEqual(stdout.toString().trim(), '[Function: apply]'); | ||
| assert.strictEqual( | ||
| stderr.toString().trim(), | ||
| 'Warning: Access control through disabling features is experimental and ' + | ||
| 'may be changed at any time.'); | ||
| } | ||
|
|
||
| { | ||
| const { stdout, stderr } = spawnSync( | ||
| process.execPath, | ||
| ['--disable=fsRead', '-p', 'process.accessControl.apply']); | ||
| assert.strictEqual(stdout.toString().trim(), '[Function: apply]'); | ||
| assert.strictEqual( | ||
| stderr.toString().trim(), | ||
| 'Warning: Access control through disabling features is experimental and ' + | ||
| 'may be changed at any time.'); | ||
| } | ||
|
|
||
| { | ||
| const { stderr } = spawnSync(process.execPath, ['--disable=unknown']); | ||
| assert.strictEqual( | ||
| stderr.toString().trim(), | ||
| `${process.execPath}: unknown --disable entry unknown`); | ||
| } | ||
|
|
||
| { | ||
| const { stderr } = spawnSync( | ||
| process.execPath, | ||
| ['--disable=fsRead', '-p', 'fs.readFileSync(process.execPath)']); | ||
| assert.ok( | ||
| stderr.toString().includes('Access to this API has been restricted'), | ||
| stderr); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this flag seems a bit too generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is generic in that it allows a wide variety of features to be disabled. Do you prefer something like
--disable-features=…? That doesn’t quite seem to add anything here, except make it a bit more work to spell out (which, you know, can totally be something we want).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--disable-featuresseems a bit better to me. i'm just looking at the flag in the context of all the other options. perhaps some bikeshedding can happen here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't bikeshed the name too much but I'm a fan of simple and concise...
--deny=and--allow=would be just fine for me. Including--allow=opens the possibility that later on we can flip the defaults on certain items, having them off by default.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, I’m not quite convinced that we’d ever want to have something off by default here (other than experimental features, for which we already have flags and which aren’t really the concern here…)