Issue #1432: Permissions proved by the compiler: what a program and each of its dependencies may reach, as WebAssembly grants imports, but at compile time

Open and answer this issue on GitHub.

note, future, safety · opened 2026-11-08 · updated 2026-11-22 · 0 comments

The goal

A security model like WebAssembly’s, checked when the program is built, not while it runs: every way a program reaches the outside belongs to a classified kind of access, the compiler derives which kinds each function, each package and the whole program need, and a build refuses what goes beyond what was granted. The guarantee comes from the compiler, per package, not per module.

This issue collects the pieces. Each is its own sub-issue below. All of it is decided by the owner (2026-11-08, in the session that worked out the concept); the ADRs that record it are still to be written and are the first item of each sub-issue. Labelled future: not for the current focus.

Why it can be done (what exists today)

Decisions (owner, 2026-11-08)

  1. Complete by construction, not by copying WASI. The vocabulary covers five groups: explicit inputs (args, env, stdin, files, network, clocks, randomness, facts about the system), explicit outputs (stdout/stderr, files, network, exit status, processes), hidden channels (timing, resource use, panic output), widening of authority (foreign code, process::spawn, build-time code), and the process’s own memory (memory safety, and Spectre, which needs a clock).
  2. Permissions are per package, never per program or module (WebAssembly’s mistake: everything linked into one module shares its imports).
  3. Whoever creates an fs::Root needs the permission; whoever is handed one does not. A library that takes a Root parameter has no file system authority of its own.
  4. A dsl block is not foreign. Its grammar has no permissions and is deterministic; the function that runs the block is derived as any function; only handing the text to a foreign interpreter (SQLite in C, JavaScript in the host) is native.
  5. native and process (spawn) are “everything”, granted explicitly per package.
  6. Two clocks: clock(wall) (date and time of day) and clock(mono) (measuring). No precision setting as a security knob: coarsening is defeated by repetition (the browsers’ lesson after Spectre).
  7. “Can measure time” and “deterministic” are properties the compiler derives, covering the hidden clocks too: select racing sleep, parallel tasks with shared mutable state, file times, network.
  8. The minimal grant is the easy path: the tool writes the derived set into the manifest; a dependency without a grant may reach nothing (fail closed).
  9. More permissions in a new version are a breaking change (major version only); fewer are always compatible.
  10. A grammar may state what its blocks reach (meta::touches), visible as the driver’s claim, apart from what the compiler derived.
  11. The registry shows, the local compiler enforces. The registry’s CI records the derived set in the index; safety never rests on it.

Sub-issues, in build order

  1. #1433 — the permission kinds, the fs::Root rule, dsl, the audit of std.contracts, nikaia permissions (ready)
  2. #1434 — grants in nikaia.toml, per dependency, and the refusal (blocked on #1433)
  3. #1435 — “can measure time” and “deterministic” (blocked on #1433; beside #1434)
  4. #1436 — a grammar states what its blocks reach (blocked on #1434)
  5. #1437 — the registry: permissions in the index, semver, resolver, sandboxed tests (ADR text ready; the build goes with the registry and needs #1434)

ADRs to write

Later, not part of these issues

#669 (std::env), #922 (file times and identity), #1253 (data from outside at raw sinks), ADR-010 (provenance), ADR-registry-1.

Back to Open Issues