On this page

0095: Capability handles and attenuation (Fs.restrict / read_only, Net grant, construction rule)

Status: Accepted (default; pending owner confirmation)

Amends ADR-0050 and ADR-0074.

Context

ADR-0050 passes platform capabilities into programs, while ADR-0074 treats capability ceilings as declared intent rather than enforcement. M10 needs capabilities that can be passed and narrowed without turning their types into ambient authority.

Decision

Fs, Net and Process are represented at runtime by i64 handles into a capability table. Handle 0 denotes the platform root authority. Stdin, Stdout, Stderr, Env and Cli remain unit-valued. A direct projection call such as cli.fs.read(path) keeps its existing handle-free native lowering; passing or storing an Fs or Process value carries a handle.

Fs.restrict(path) canonicalizes the requested root when called. A missing root returns NotFound; a root outside its parent returns Denied. Relative paths resolve beneath the root, and absolute paths must canonicalize beneath it. Traversal or symlink escapes return Denied. Fs.read_only() creates a view whose writes are denied. Both backends use resolve-then-prefix checks. These checks have a TOCTOU window against concurrent attackers and are a capability-discipline boundary, not the security boundary; the OS sandbox is.

The Net grant provides restrict(hosts) and none(), and adds the net ceiling category. M10 adds no connect operation; process sandboxing consumes the grant, with network enforcement specified separately. Capability values are not constructible by ordinary program code; platforms provide them.

Alternatives considered

Consequences

Programs passing or storing handle-bearing capabilities have intentional IR and emitted-C changes. Direct capability calls retain their existing output. Filesystem attenuation must not be described as protection against a hostile concurrent process; the OS sandbox provides that boundary.