Skip to content

permission: revoke fs grants regardless of current path type - #67613

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:permission-drop-match-grant
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:permission-drop-match-grant

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

process.permission.drop() looks up the grant to revoke by recomputing whether the reference is a directory at drop time, and then searching for that exact string. Grants are stored with a trailing wildcard only when the path was a directory at grant time, so a path that was granted before it existed (a typical output or cache directory), or whose type changed since, was silently not revoked: drop() returned normally and access stayed in force.

Revocation now matches the stored grant in both its plain and wildcard forms, without depending on the current state of the file system.

Adds tests for fs.read and fs.write covering a path created as a directory after the grant and a directory replaced by a file.

AI-assisted work. All changes reviewed by a human.

A grant is stored with a trailing wildcard when the path is a directory
at grant time. `drop()` recomputed that form from the current state of
the file system, so a path granted before it existed, or whose type
changed since, was silently not revoked. Match the grant in both forms
instead, and add tests for both file system scopes.

Assisted-By: OpenAI GPT-5.6 Sol <openai/gpt-5.6-sol>
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@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. permission Issues and PRs related to the Permission Model. labels Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.71%. Comparing base (d9e18d5) to head (19552d5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/permission/fs_permission.cc 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67613      +/-   ##
==========================================
- Coverage   90.72%   90.71%   -0.02%     
==========================================
  Files         801      801              
  Lines      280809   280811       +2     
  Branches    54212    54215       +3     
==========================================
- Hits       254776   254726      -50     
- Misses      16209    16257      +48     
- Partials     9824     9828       +4     
Files with missing lines Coverage Δ
src/permission/fs_permission.cc 76.41% <76.92%> (+0.22%) ⬆️

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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. permission Issues and PRs related to the Permission Model.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants