Skip to content

Filesystem gate - #30

Merged
scothis merged 21 commits into
componentized:mainfrom
scothis:gate
Oct 19, 2026
Merged

scothis merged 21 commits into
componentized:mainfrom
scothis:gate

Conversation

@scothis

@scothis scothis commented May 15, 2026 •

Copy link
Copy Markdown
Member

Adds access control for wasi:filesystem, following the gate and latch
model of the http and sockets repos. The gate consults a latch before
each operation; the latch defers or denies, and is told the final
decision with observe-decision.

Intercept wasi:filesystem calls allowing per call access control
decisions. The 'gate' is a component that virtualizes the
wasi:filesystem interfaces and also import a latch interface. The latch
defines the access control check and returns a decision.

For any call, a latch can either allow, deny or abstain. Denials include
an error-code as the reason. Latches can be composed together to define
more advanced behavior. The latch-N components compose N latches
together. An allow or deny decision is returned immediately while an
abstain decision allows the next latch to have an opinion.

For example, if we want to make a component's access to the filesystem
be read-only while other parts of the runtime need read-write, we can
compose the ro-consume with a gate, while the rw-consumer has full
access to the filesystem. The latch is itself a composition of two other
latches, the first is the read-only latch which denies calls that would
modify the filesystem. The allow latch approves calls that have
otherwise not been denied. The composition enabled additional behavior
be added, such as denying access to certain directories, or any other.
behavior a use chooses to implement. Replace the latch2 component with
latch3 when there is a third latch to orchestrate.

```
              host
             ↗    ↖             ↗ latch-readonly
  rw-consumer     gate → latch2
                   ↑            ↘ latch-allow
               ro-consumer
```

Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
The preopens interface and directory-entry-stream resource are a bit
different as we allow the call and check if the returned value should be
passed back to the caller. This allows the gate to filter the preopened
filesystems, or files in a directory.

Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
- allow -> some(permitted)
- deny -> some(denied)
- abstain -> none
- check -> authorize
- latch-allow -> latch-permit-all
- latch-deny -> latch-deny-all

Signed-off-by: Scott Andrews <scott@andrews.me>
The gate now treats `Some(Permitted)` and `None` authorization decisions
as allowing the operation. This dramatically simplifies use of a single
latch as it no longer needs to be aggregated with allow-all. Not needing
an aggregation also means `wac plug` can manage the composition, while
an aggregation requires a wac script or custom embedding to manage the
interface names.

Signed-off-by: Scott Andrews <scott@andrews.me>
The effective path is now passed as part of the operation. This enables
a latch to consider the path of an operation. `latch-glob` uses glob
pattern matching on the path to permit or deny an operation.

Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
pull common latch bits into crates/filesystem-latch

Signed-off-by: Scott Andrews <scott@andrews.me>
Signed-off-by: Scott Andrews <scott@andrews.me>
@scothis
scothis marked this pull request as ready for review October 19, 2026 00:20
@scothis
scothis merged commit b465421 into componentized:main Oct 19, 2026
3 checks passed
@scothis
scothis deleted the gate branch October 19, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant