Grants and capabilities
Exact's grant families, the grants Seed Exact declares and why, where each host enforces them, and what a refusal looks like.

A grant is one line that allows the data module to reach one thing: a network origin, a file path, a named secret. Exact injects nothing by default, so anything app.ts does not list is refused. This page covers Exact's grants. A Seed capability (a signed delegation of write access between accounts) is a different thing, see the glossary.

The families

Exact's grants/src/lib.rs defines the grant kinds. "The parameter is the scope, and there is always a scope."

Line

Admits

net.fetch <origin>

fetch to exactly that scheme, host and port

net.fetch https://*.example.com

Every host strictly under the suffix

net.fetch https: or http:

Every origin of the scheme, "for a server the person names at run time"

net.websocket <origin>, wss:, ws:

WebSockets, with the same three forms. wss: does not admit ws:

net.fetch local-network

Hosts on the local network

fs.read <path>, fs.write <path>

A file subtree, compared by whole path components

sqlite.open <path>

One database

secret.keep <name>

Read, replace and forget one named secret

env.read <name>, storage.kv <scope>

One environment variable, one key-value scope

Grants cross no kinds: "an fs.read grant admits no network operation" (lib.rs L207-L246).

The app's grants

app.ts L16-L28 exports one string, built from literals joined by newlines. "Grants must be literal here (the build reads them without running the module)."

Grant

Purpose

Used by

net.fetch https:

Any HTTPS server: the person can type any Seed site, vault or agents server

Seed site read API, all modules

net.fetch https://dev.hyper.media

Redundant with the line above. Kept from the profile package's live dev tests

Profile

net.fetch http://127.0.0.1:4790 (listed twice)

The local test server

The local test server

secret.keep seed-keys

The Keychain item holding every private key

Identity: key storage

net.fetch http://127.0.0.1:3058

Stale: the agents mock binds 3068 (sources.ts L16-L17). It works through the next line

Mock agents server

net.fetch http:

Any plain HTTP server, for local daemons and self-hosted servers

Agents

net.websocket wss:, net.websocket ws:

Agent streams

Agents streams

secret.keep seed-vault-kek

The vault's key-encryption key and remote credential

Vault store

fs.read app:/data/vault/envelope.json

Read the encrypted vault file

Vault store

fs.write app:/data/vault

Write that file and create its folder

Vault store

The app holds no sqlite.open grant and stores nothing else on disk. currentAccount and server are persisted Contract state, not secrets.

What the module receives

answer(source, args, store, storage, native) gets two capability objects (app.ts L44-L45):

    store is {get, set, forget} for secrets. Reads are synchronous because "the host reads them into a snapshot before boot" (reference).

    storage.fs gives readFile, atomicWriteFile, mkdir and others under app:/. Only the vault uses it (store.ts L33-L40).

Where grants are enforced

Host

Network

Secrets

Files

iOS

The Rust host checks every request, and "each redirect target against the source's net.fetch grants before contacting it". App Transport Security still refuses http: beyond the local network unless app.json allows it, which this app does not

The Keychain

The app's sandbox, under app:/

Web host

Checked by Exact's runtime, but "the web lets the browser follow and checks only the final response URL". "Exact API grants do not sandbox page code"

localStorage

Browser storage for the page's origin

Test drives

Each test gets its own scratch store, removed after it. A web drive with no --storage keeps no secrets

scratch store

scratch store

Quotes are from Exact's reference. The consequence for this project is in The web host for development: a redirect chain that passes on the web can be refused on a phone.

What a refusal looks like

    Fetch. The promise rejects with a FetchError of kind Refused. A stream ends with {type: 'error', kind: 'Refused', โ€ฆ} ("outside the grants").

    Storage. An Error with kind: 'Unavailable' and code: 'denied' ("the grants do not cover it"). Other codes are POSIX names such as 'ENOENT'. "Branch on the code, never the message" (reference).

    Secrets. A secret.keep name must be listed, and writes are "grant-checked, in Rust" (lib.rs).

    In the view. The resource fails, failed(x) is true and failure(x) carries code refused, if the source lets the rejection through. Most app sources catch it and return a friendly message instead, for example read/client.ts L12-L18.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0
Linked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentGrants and capabilitiesGrants and capabilities
Citations 0Children & links 15

Loading child documentsโ€ฆ

Connections show where other documents or comments link to this document.

Related documents

Loading connectionsโ€ฆ