[trust] replaces trusted: true on calls (ADR-trust-v1)Open and answer this issue on GitHub.
ready, safety, queued · opened 2026-11-22 · updated 2026-11-29 · 0 comments
A program says in its own manifest which sources its operator chose. The trusted: true marker on a call goes away. Decided in ADR-trust-v1 (docs/specification/adr/adr-trust-v1.md, commit 671236870 “ADR-trust-v1: trust is set in the program’s manifest, not at a call”), which replaces ADR-365 D2 and ADR-399 D3.
# nikaia.toml of a benchmark
[trust]
stdin = true # every read of standard input
args = true # cli::args() and main's parameters
files = ["data"] # or true
// before (ADR-365 D2)
let path = cli::args(trusted: true).nth(1) ?? "measurements.txt"
let b = fs::map(ref path, fs::Root::Anywhere; trusted: true)
// after: no option; the manifest above says it once
let path = cli::args().nth(1) ?? "measurements.txt"
let b = fs::map(ref path, fs::Root::Anywhere)
Part of the safety lane (ADR-397, ADR-raw-sinks-1). Found while answering the owner’s question on benchmarks (2026-11-22: “dieses Vertrauen ist eine Programmeigenschaft”).
ADR-trust-v1 D1-D5. Text only today; nothing of it is built.
trusted: bool = false is an option in crates/nikaia-std/std.contracts (the cli::args signature, the io/fs sources). The marker is read in crates/nikaia-std/src/compiler/trust.nika (the marked_at field, the “source method marked trusted: true” arm) and recorded in ledger.nika (the comment “Each trusted: true the body wrote”).[allow] pattern in crates/nikaia-std/src/compiler/manifest.nika (raw_sinks_allow_keys, raw_sinks_allow_sources), so no new TOML reader is needed.[trust] from the program’s manifest only (D1, D3).
manifest.nika / project_settings.nika.stdin, args, files. Each takes true; files also takes a list of directories.false, or an entry with a .. component is a manifest error, refused naming the keys, as an [allow] typo is.[trust] is ignored.trust.nika and the prover’s source rules.stdin makes every standard-input read trusted.args makes cli::args() and main’s parameters trusted.files = true makes every fs read trusted, including the names walk/read_dir return.files = [dirs] makes a read trusted only under fs::Root::Dir(d) where d is proved at or below a listed dir by component (path::is_below, ADR-raw-sinks-1 D14).Anywhere stays untrusted.trusted: option from io::read, io::read_to_string, io::lines, cli::args and every fs read in std.contracts (D4).
NK1109. Its help names the [trust] line that says the same, e.g. stdin = true.trusted: false goes too.@untrusted grammar stays.--trust (D5).
trusted row reads "fs::map at main.nika:7 (files: data)".[trust] table.--trust prints the table with its manifest line, then each call it covers.render in trust.nika changes; it says “trusted: true at …” today.prover_state.nika help that writes cli::args(trusted: true), and the trust.nika:266 comment, write the [trust] line instead.grep -rn "trusted: *true" --include=*.nika).
nikaia.toml with [trust] and loses its markers:
benches/brc: fast 3, fast-unsafe 3, naive 3, scan 1benches/game/k-nucleotide: main 2, speed 1benches/wide-ops/wide.nika: 1[trust] where it reads its own data, or proves the read (ADR-raw-sinks-1 D16):
examples/1brc.nika: 4. It is a single file, so it needs a manifest beside it.examples/access-log, config, json, k-nucleotide (3), report (2), tallytests/compiler/tests/:
Each is rewritten to write a nikaia.toml with [trust] in its tmp project, or renamed where its name says “marked”. New expected output only where the decision changes the message; never a loosened one.
website/safe/ pages (index.html, outside-data.html)..nika with .stdout/.stderr):
[trust] stdin = true makes a claim on stdin checked, not NK1202.files = ["data"] trusts a read under Root::Dir("data/x") but not under Anywhere nor Root::Dir("other").files = ["../x"], files = false and an unknown key are each a manifest error.trusted: true on a call is NK1109, with the help naming stdin = true.[trust] does not reach the caller.nikaia run of a program whose manifest has [trust] stdin = true and that claims a property of a stdin line builds without NK1202. The same call written as io::read_to_string(trusted: true) is refused with NK1109, whose help names stdin = true. grep -rn "trusted: *true" --include=*.nika finds no use outside the refusal test. The commit that finishes step 6 says Fixes #N. The report gives a Found: line per finding.
Generated by Claude Code