[glob] readdir causes EACCES: permission denied, scandir
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
As you can see from the above snippet, internal-globber.ts doesn't check if the directory is readable before attempting to read it.
There should be a try catch block around that code:
try {
const childLevel = item.level + 1;
const childItems = (await fs.promises.readdir(item.path)).map(
x => new SearchState(path.join(item.path, x), childLevel)
);
stack.push(...childItems.reverse());
catch (err) {
if (err.code === 'EACCES') {
continue;
}
throw err;
}
This issue affects the upload-artifacts action, plus I'm sure other actions that depend on this package.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/glob/src/internal-globber.ts at lines 142-145, where readdir is called while traversing directories. Verify how permission-denied errors are currently handled, then confirm that EACCES directories are skipped while other errors still propagate; the change should prevent upload-artifacts and other glob users from failing on unreadable directories.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100