Skip to content
1 min read · 221 words

Type Alias: FsNode

ts
type FsNode = {
  canRead: boolean;
  canWrite: boolean;
};

Defined in: src/batteries/sandbox/node/fs_node.ts:43

The in-process policy decision procedure.

Remarks

BESPOKE POLICY CODE, not a thin wrapper: SRT exports rule LISTS (getFsReadConfig()/getFsWriteConfig()) but no authorization predicate, so the decision is ours to make and ours to get wrong. It backs the tools that run OUR code — open_file*, stage_file, save_media, list_directory — where there is no untrusted binary between the check and the open(), so applying the same derived rules in-process is the same path without a subprocess rather than a weaker one.

The residuals are real and unmitigated: a TOCTOU race between check and open, and any bug in this evaluator. There is no OS backstop on this path — SRT restricts spawned children only. The compensating controls are the mandatory gate and a narrow writeRoot.

Methods

canRead()

ts
canRead(path: string): boolean;

Defined in: src/batteries/sandbox/node/fs_node.ts:45

Whether a read of path is permitted. Reads default to ALLOW; allowRead wins inside denyRead.

Parameters

ParameterType
pathstring

Returns

boolean


canWrite()

ts
canWrite(path: string): boolean;

Defined in: src/batteries/sandbox/node/fs_node.ts:47

Whether a write to path is permitted. Writes default to DENY; denyWrite wins inside allowWrite, and the mandatory-deny set applies on top.

Parameters

ParameterType
pathstring

Returns

boolean