Skip to content

permission: fix parent directory over-grant in fs radix tree#64418

Open
Nashit-h wants to merge 1 commit into
nodejs:mainfrom
Nashit-h:fs-permission-parent-overgrant
Open

permission: fix parent directory over-grant in fs radix tree#64418
Nashit-h wants to merge 1 commit into
nodejs:mainfrom
Nashit-h:fs-permission-parent-overgrant

Conversation

@Nashit-h

Copy link
Copy Markdown

The FSPermission radix tree marks a node as a leaf whenever a newly inserted grant is routed through it, but a routed-through node is only a shared path prefix, not an allowed entry, so an unrelated parent directory becomes readable. For example --allow-fs-read=/etc/app/logs/* alongside --allow-fs-read=/etcd/data/file and --allow-fs-read=/etcx/y makes process.permission.has('fs.read', '/etc') return true. Mark a node as a leaf only when it already ends an inserted path, and keep directory self-access working (has('/dir') when /dir/* is granted) by checking for the trailing-wildcard grant during lookup.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants