Skip to content

Commit

Permalink
test,doc: clarify wildcard usage
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Feb 13, 2024
1 parent d01dd42 commit d6da413
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion doc/api/permissions.md
Expand Up @@ -557,7 +557,10 @@ Wildcards are supported too:
* `--allow-fs-read=/home/test*` will allow read access to everything
that matches the wildcard. e.g: `/home/test/file1` or `/home/test2`

#### Limitations and known issues
After passing a wildcard character (`*`) all subsequent characters will
be ignored. For example: `/home/*.js` will work similar to `/home/*`.

#### Permission Model constraints

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

Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-permission-fs-wildcard.js
Expand Up @@ -107,11 +107,15 @@ if (common.isWindows) {
'--experimental-permission',
'--allow-fs-read=/a/b/*',
'--allow-fs-read=/a/b/d',
'--allow-fs-read=/etc/passwd.*',
'--allow-fs-read=/home/*.js',
'-e',
`
const assert = require('assert')
assert.ok(process.permission.has('fs.read', '/a/b/c'));
assert.ok(!process.permission.has('fs.read', '/a/c/c'));
assert.ok(!process.permission.has('fs.read', '/etc/passwd'));
assert.ok(process.permission.has('fs.read', '/home/another-file.md'));
`,
]
);
Expand Down

0 comments on commit d6da413

Please sign in to comment.