Expand description
The realm’s permission container, and the checks every module makes.
The policy itself is ferrijs_permissions; this module is where it
meets QuickJS: the Container is stored as context userdata, each
fs / os / network entry point calls one of the check_* helpers,
and a refusal is thrown into JS as a PermissionDeniedError carrying
Node’s ERR_ACCESS_DENIED code plus the permission and resource
Node attaches.
A realm with no container installed is unrestricted. The ferrijs
runtime always installs one (deny-all unless the host grants more);
a host embedding this crate without the runtime calls install
itself, or gets a standard library with no sandbox.
The container is the realm’s for its whole life and only narrows. Nothing here carries a policy across a callback: a timer fires under the same container it was armed under, because there is only one.
Functions§
- check_
env - Errors
- check_
net - Errors
- check_
read - Errors
- check_
sys - Errors
- check_
write - Errors
- container
- The realm’s container, if a host installed one.
- drop
- Give up
resourceunderkind(or the whole kind) for good: Node’sprocess.permission.drop. Nothing when no container is installed. - has
- Whether
kindcoversresourceright now, for ahas()-style query. Unrestricted when no container is installed. - install
- Install the realm’s container. A second call replaces the first.
- throw_
denied - Throw
deniedinto JS as aPermissionDeniedError.