Repository navigation
fs.glob (async and sync) returns no matches when --allow-fs-read is used #61499
Description
Activity
- addedpermissionIssues and PRs related to the Permission Model.Issues and PRs related to the Permission Model.
on Jan 24, 2026 Does
somedirexists previously? if not, try with--allow-fs-read="somedir/*". I'm not on my computer to test it right now.yep,
somedirexists prior to running the sample files. I also did having asomedir/*, it still throws an errorI'm working on this issue, and it seems I've found the root of the problem. The thing is, during sync processing, we get a folder access error that we don't handle in any special way. Meanwhile, in cases like glob(), we handle this situation and simply continue traversing the directories. I'm currently working on a fix
Reacted by Louie LlanetaFWIW, after #60674 was merged, the
ERR_ACCESS_DENIEDdoes not show up anymore, but still doesn't show any matches within the directory- changed the title
[-]fs.globSync can't traverse on allowed directory by specific `--allow-fs-read`[/-][+]fs.globSync returns no matches when `--allow-fs-read` is used[/+]on Mar 12, 2026 - changed the title
[-]fs.globSync returns no matches when `--allow-fs-read` is used[/-][+]fs.glob returns no matches when `--allow-fs-read` is used[/+]on Mar 27, 2026 github-actions commented
on Jul 20, 2026 on Jul 20, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 20, 2026 - addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.and removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 29, 2026 - changed the title
[-]fs.glob returns no matches when `--allow-fs-read` is used[/-][+]fs.glob (async and sync) returns no matches when `--allow-fs-read` is used[/+]on Sep 10, 2026 Update:
Asynchronousfs.globare now also affected by thisSome workaround (for anyone who might be experiencing the same thing as me):
Granting--allow-fs-readpermission to the parent of the first directory of the glob pattern does the trickExample:
|-- parent-folder/ |-- a/ |--- file.jsand that your glob path is
fs.glob(`a/file.js`, ...)
Grant by the parent folder and because it's a relative,
--allow-fs-read=.instead of thea/specific folderFor absolute glob patterns, like
/home/user/folder/*, inconveniently, it's granting permission to the root,--allow-fs-read=/
Version
22.22.1 (22.x), 24.14.0 (24.x), 25.8.1 (25.x)
Platform
Subsystem
fs, permission
What steps will reproduce the bug?
Create the file
sample1.js
Directory Structure
Run the following commands:
How often does it reproduce? Is there a required condition?
The bug consistently reproduces if the --allow-fs-read is given a specific directory such as
somedir/, but not with the allow all*What is the expected behavior? Why is that the expected behavior?
fs.globSyncshould return matches as it has a read access to that given directoryfs.glob(also fromnode:fs/promises) returns matches to that given directoryCode snippet for checking
fs.globworking as intendedsample2.js
(works just fine - for comparison)
sample3.js
(works just fine - for comparison)
Running the files
What do you see instead?
Empty matches
Additional information
came across this when @RafaelGSS suggested to include permission model tests while using glob on --watch-path
Refs: #59478