Issue #2919: Raw-sink prover: an empty literal start and a match binding pass outside text as proved

Open and answer this issue on GitHub.

ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments

Found

Two holes in the NK1308 prover (ADR-raw-sinks-1 D18). On develop (5d6ac6060) neither function below draws NK1308, but in both, text from cli::args reaches the start of a process::run argument:

use std::cli
use std::process
fn joined() throws {
    let s = ""
    let arg = s + (cli::args().nth(1) ?? "")
    process::run("git", ["show", arg])          // silent: should be NK1308
}
fn matched() throws {
    match cli::args().nth(2) ?? "" {
        tip => process::run("git", ["show", tip]),   // silent: should be NK1308
    }
}
fn direct() throws {
    process::run("git", ["show", "" + (cli::args().nth(1) ?? "")])   // warns, correct
}
fn main() throws {
    if cli::args().len() > 7 { joined() matched() direct() }
}
  1. Empty literal start. operand_proved (prover_calls.nika, ~1018) takes literal_only as proved, and "" is a literal. A name bound to "" then starts every concatenation it heads as “proved”, although the empty text proves nothing about what follows. The direct form "" + x is judged correctly, so the gap is in how a bound name’s start is carried.
  2. Match binding. A name a match pattern binds to the scrutinee does not carry the scrutinee’s origin, so outside text bound that way reaches the sink unchecked.

To build

Done when

The probe warns at both sites, the twins stay silent, and nikaia check --bounds scripts/drive.nika draws no new NK1308 except where it really passes outside text (each new one is fixed in drive.nika with a proof, not with [allow]).

Part of #2694.

Back to Open Issues