Skip to content

Commit ef3eea2

Browse files
RafaelGSSmarco-ippolito
authored andcommitted
1 parent 208b394 commit ef3eea2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

doc/api/permissions.md

+3
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ Wildcards are supported too:
560560
* `--allow-fs-read=/home/test*` will allow read access to everything
561561
that matches the wildcard. e.g: `/home/test/file1` or `/home/test2`
562562

563+
After passing a wildcard character (`*`) all subsequent characters will
564+
be ignored. For example: `/home/*.js` will work similar to `/home/*`.
565+
563566
#### Permission Model constraints
564567

565568
There are constraints you need to know before using this system:

test/parallel/test-permission-fs-wildcard.js

+4
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ if (common.isWindows) {
107107
'--experimental-permission',
108108
'--allow-fs-read=/a/b/*',
109109
'--allow-fs-read=/a/b/d',
110+
'--allow-fs-read=/etc/passwd.*',
111+
'--allow-fs-read=/home/*.js',
110112
'-e',
111113
`
112114
const assert = require('assert')
113115
assert.ok(process.permission.has('fs.read', '/a/b/c'));
114116
assert.ok(!process.permission.has('fs.read', '/a/c/c'));
117+
assert.ok(!process.permission.has('fs.read', '/etc/passwd'));
118+
assert.ok(process.permission.has('fs.read', '/home/another-file.md'));
115119
`,
116120
]
117121
);

0 commit comments

Comments
 (0)