Skip to content

ffi: check permission before reading VFS library - #67369

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-dynlib-permission
Open

trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-dynlib-permission

Conversation

@trivikr

@trivikr trivikr commented Nov 9, 2026

Copy link
Copy Markdown
Member

Fixes: #67368

This PR calls checkFFIPermission() in the JS DynamicLibrary wrapper before it reads from the VFS, and adds a regression assertion to test/ffi/test-ffi-permissions.js.


Assisted-by: claude:opus-5.5

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@nodejs-github-bot nodejs-github-bot added ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run. labels Nov 9, 2026
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. vfs Issues and PRs related to the virtual filesystem subsystem. labels Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.72%. Comparing base (f39899d) to head (3c967f7).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67369      +/-   ##
==========================================
- Coverage   90.73%   90.72%   -0.02%     
==========================================
  Files         798      798              
  Lines      280017   280018       +1     
  Branches    53860    53858       -2     
==========================================
- Hits       254076   254036      -40     
- Misses      16235    16287      +52     
+ Partials     9706     9695      -11     
Files with missing lines Coverage Δ
lib/ffi.js 96.42% <100.00%> (+<0.01%) ⬆️
src/node_ffi.cc 74.82% <ø> (ø)

... and 32 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.

new DynamicLibrary(path) read a library inside a mounted VFS before
the native --allow-ffi check ran, so a missing VFS path threw ENOENT
instead of ERR_ACCESS_DENIED. Check the permission first, as
ffi.dlopen() does.

Also correct a comment that claimed dlopen errors report the
library's own path.

Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
Assisted-by: claude:opus-5.5
@trivikr
trivikr force-pushed the ffi-dynlib-permission branch from 51599d6 to 3c967f7 Compare November 10, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ffi: new DynamicLibrary() reads a VFS path before checking --allow-ffi

2 participants