You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src: enforce FFI permission on DynamicLibrary instance methods
The DynamicLibrary::New constructor checks permission::PermissionScope::kFFI,
but the instance methods (InvokeFunction, GetFunction, GetFunctions,
GetSymbol, GetSymbols, RegisterCallback, UnregisterCallback, RefCallback,
UnrefCallback, Close) did not, creating a defense-in-depth gap.
An attacker able to obtain a DynamicLibrary handle through shared state
(e.g. a leaked reference from trusted code) could invoke arbitrary native
functions, resolve symbols, register executable callback trampolines, and
otherwise perform FFI operations even though --allow-ffi was not granted.
The critical gap was InvokeFunction: once a function handle was created,
executing it bypassed the permission model entirely. The audit mode also
failed to surface these violations.
Add THROW_IF_INSUFFICIENT_PERMISSIONS to every instance method, matching
the defense-in-depth pattern already used by the raw memory helpers in
src/ffi/data.cc (GetInt*, SetInt*, ToString, ToBuffer, ToArrayBuffer).
Refs: nodejs#62072
0 commit comments