Issue #1434: A program grants permissions in nikaia.toml, for each dependency too, and the build refuses what reaches beyond them

Open and answer this issue on GitHub.

tools, compiler, blocked, future, safety · opened 2026-11-08 · updated 2026-11-22 · 0 comments

Part of #1432. Blocked on #1433 (the vocabulary and the derivation). Decided by the owner (2026-11-08); the ADR is item 1.

Done when

A build whose program, or one of whose dependencies, reaches a permission kind its manifest does not grant fails, naming the call chain to the std entry and the line to add to nikaia.toml; a dependency without a grant reaches nothing; and every function value, trait call, dsl run and extern call the compiler cannot resolve counts as everything.

The manifest (decided)

[permissions]                  # what the program may reach
grant = ["file(Dir('config')) read", "net connect", "stdout write"]

[dependencies.json]
path = "../json"
permissions = []               # json may reach nothing

[dependencies.http]
version = "1.2"
permissions = ["net"]

To build

  1. The ADR (working name ADR-permissions-1, the second part): the manifest keys, fail closed for dependencies, what the check compares, the refusal.
  2. Soundness first, before any refusal is trusted. In the derivation of #1433, show by tests that each of these counts as everything where the compiler cannot resolve it: a function value stored in a field (the ledger’s code key, ADR-351 D8, resolves what it can); a lambda passed to a higher-order call (its touches is added at the call, never left out: docs/history/from-for-throws-and-touches.md §4-5); a call through a trait bound; a dsl block’s run function; an extern call; process::spawn. Each one is a .nika test whose report shows the expected set. A gap found is fixed as its own commit.
  3. Reading [permissions] and permissions: an unknown kind or mode fails the build, naming the known ones.
  4. The check: the union over what main reaches against grant; per dependency, the union over what its pub functions reach against its permissions. The refusal takes a new NK code, reserved by the supervisor, with the message, the call chain and the line to add (Appendix C). Tests: a program that writes a file it did not grant; a dependency that opens a socket with permissions = []; a dependency with no key at all.
  5. nikaia add writes the derived grant for the dependency it adds; nikaia permissions --write writes the program’s own. Output test.
  6. The ledger diff names a changed permission in a dependency’s update, and --locked fails on it, as for any contract change.

Files and limits

The manifest reader, touch.nika, the tool behind nikaia add, a new diagnostic. No change to what touches orders. A program without a [permissions] table: decided in the ADR whether it means “everything” (as today) or is refused; recommendation for the ADR: everything for the program itself, fail closed for dependencies, so existing programs keep building.

Ruled out

Back to Open Issues