Open and answer this issue on GitHub.
note, future, safety · opened 2026-11-08 · updated 2026-11-22 · 0 comments
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.
touches in the ledger (Part III 13.5, ADR-292, crates/nikaia-std/src/tools/touch.nika): which resource a function reaches and whether it reads or writes, derived over the call graph and written to nikaia.contracts for every function. This is the classification.touches means it touches everything. Code the compiler cannot see is given no right; a gap in the vocabulary costs precision, never soundness.extern + unsafe (Part III 15.1); an extern declaration and a Rust crate have fail-closed touches.NK1152, “this function may not run while the program is built”). Rust’s build.rs problem does not exist here.unsafe: a permission cannot be forged through a pointer. WebAssembly needs its linear memory at run time for this.fs::Root (Part III 17.1): every file access names its root; Dir(store) refuses a name that would leave it (io::IoError::Outside). This is WASI’s preopened directories, already in the language.dsl block’s grammar runs confined and deterministic at build time; holes are parameters, never spliced text, so a run-time value cannot change what a block means (Part II 10.2, 10.5).process::spawn, build-time code), and the process’s own memory (memory safety, and Spectre, which needs a clock).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.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.native and process (spawn) are “everything”, granted explicitly per package.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).select racing sleep, parallel tasks with shared mutable state, file times, network.meta::touches), visible as the driver’s claim, apart from what the compiler derived.fs::Root rule, dsl, the audit of std.contracts, nikaia permissions (ready)nikaia.toml, per dependency, and the refusal (blocked on #1433)ready; the build goes with the registry and needs #1434)fs::Root rule, the place of dsl, the manifest and its enforcement, the grammar’s own claim (decisions 1-5, 8, 10; #1433, #1434, #1436).fs::Root, so a library gets no network authority of its own. Only once net grants prove too coarse in practice.provenance (ADR-010) and #1253, not a permission.wasm32) generated from the derived set, so the guarantee also holds for a modified binary.task::OverBudget).#669 (std::env), #922 (file times and identity), #1253 (data from outside at raw sinks), ADR-010 (provenance), ADR-registry-1.