Issue #2332: The raw path sink check (NK1308) is switched from warn to deny

Open and answer this issue on GitHub.

blocked, safety · opened 2026-11-19 · updated 2026-11-21 · 3 comments

What

The last step of the staged refusal (docs/issues.md I9): once the check is on develop behind raw-sinks = "warn" (#2303) and our own code passes it by proof (#2301 for tests/compiler/tests/ and std, #2302 for the compiler, scripts/, examples/ and packages/), the setting’s default becomes deny. A path from outside reaching fs::read_*, fs::write, fs::remove_* or fs::Root::Dir(...) is then refused unless a proof covers it (a clean Dir root, a guard path::is_component / path::is_below, a read_dir name under the same root) or the manifest allows that source for that operation (ADR-raw-sinks-1 D15).

Part of #2242 Part of #1253 Needs #2301 Needs #2302 Needs #2303

Today: the check is not on develop (it is on the local ref wip/issue-2242, 0254f60c3); #2303 brings it, with the setting at warn. This issue was item 6 of #2303, split off so the check and the D15 keys land before the two migrations that need them.

Governing decision

ADR-raw-sinks-1 D1-D16; the setting raw-sinks named by #2303.

Done when

raw-sinks defaults to deny; nikaia check of a program reading cli::args()[1] into fs::read_to_string(p, fs::Root::Anywhere) gives NK1308 as an error with the source and the sink named, and the same program with untrusted-paths-read = ["args"] in its manifest builds; the full suite is green in the driver’s run. The switch commit carries Fixes #THIS. A Found: line per finding.

To build

  1. Check that no site is left: run the check over the whole repository with the setting at warn; every warning left is a Found: (file, line, what it would need) and the switch waits (Result: blocked).
  2. The switch: the default of raw-sinks to deny where #2303 set it to warn; the .stderr files that change from warning to error updated in the same commit. Test: the test of #2303’s item 4 (a_manifest_allows_untrusted_paths_per_operation_and_source.nika) now shows NK1308 as an error for the cases it refuses.

Files and limits

The place that sets the default of raw-sinks (as #2303 leaves it), its lowered file, the .stderr files that change. No site migrations here (those are #2301 and #2302), no new Rust.

Ruled out

Comments

keywan-ghadami, 2026-11-20

Found while the suite of #2303 ran: examples/inventory/src/main.nika still opens cli::args() paths under fs::Root::Anywhere (fs::map(ref path, ...) line 25, fs::write(ref out, ...) line 41). Today that is a warning, and sequences::no_loose_program_in_the_repository_is_refused does not check inventory, because it is a package with sibling files. Under deny it is refused. The other examples (access-log, config, json, report, tally) mark their paths cli::args(trusted: true), which counts as the operator’s choice under ADR-raw-sinks-1 D2/D16. The switch to deny takes inventory along.


Generated by Claude Code

keywan-ghadami, 2026-11-21

Needs #2466

“The driver queues an issue unchecked when scripts/issue-check.nika fails to run” (#2466): once this switch lands, scripts/issue-check.nika no longer builds, because it reads its --body FILE under fs::Root::Anywhere. The driver currently counts a failed check as “no findings”, so every issue would be queued unchecked. #2466 makes the driver hold the issue back instead, and passes the body over stdin, so no path and no NK1308 are involved.

Agreed order (bug lane and safety lane, owner approved 2026-11-21):

  1. #2466
  2. “The compiler, scripts and packages pass the raw path sink check by proof, not trusted:” (#2302), for scripts/
  3. this issue

The label stays blocked.


Generated by Claude Code

keywan-ghadami, 2026-11-21

Two points for the switch, found reviewing 2d882ff1 (the fix for #2520):

  1. The word is error, not deny. ADR-raw-sinks-1 D3 says “The default is error”, and project_settings.nika accepts warn / error (manifest("raw-sinks", "warn"), like refuted-claims and unproved-claims). The Done when means raw-sinks defaults to error.
  2. The specification follows in the same commit. #2303 rewrote Part III to call warn the default. Each place below goes back to D3, so that nowhere calls warn the default:
    • docs/specification/30-nikaia-tooling.md 13.3, the raw-sinks sentence (“at warn, the default, …”; about line 79);
    • the same file, 14.2, the NK1308 paragraph (“At raw-sinks = \"warn\", the default, …”; about line 541);
    • the manifest example raw-sinks = "warn" with its comment (about line 140).

    Until the switch, Part III does not match ADR-raw-sinks-1 D3. That is the staged refusal of I9; this issue is where it ends.


Generated by Claude Code

Back to Open Issues