code wiki / (root) / nx_content_get_gate.nx

nx_content_get_gate.nx

buildroot/runtime/nx_content_get_gate.nx

15714 B326 linesdepth 5pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic content
docsdependenciesstructsconstsfunctions

about

nx_content_get_gate.nx -- THE GATE FOR THE NAS->LAPTOP DOOR, 2026-09-03. SUBJECT: the BUILT nx_content_get elf, forked end-to-end. Its verbs are the whole contract, so an in-process gate could not test the thing that matters (argv parsing, exit codes, the wire receipt). argv[1] overrides the subject path so nx_gate_bite can hand it a mutant. THE TEETH THAT CARRY THE CLAIM ARE T4/T5 AND T10, and each is a law this estate has been bitten by: T4 IS A FIXTURE ASSERTION, NOT AN OUTCOME. It proves the big fixture actually forced nchunks>1 BEFORE T5 judges reassembly. Without it, a subject that fits in one chunk would let T5 pass while the multi-chunk path -- the only path that can corrupt -- was never executed. The single-chunk case looks identical to a working transfer from the outside. T10 IS THE POSITIVE CONTROL FOR THE REFUSALS. T7/T8/T9 all assert a REFUSAL, and a guard that refuses EVERYTHING passes every one of them. T10 demands a legitimate path be ACCEPTED, so the deny-tests can only pass on a guard that actually discriminates. T3 uses the gate's OWN one-shot sha256_digest against the tool's STREAMING sha256_update path -- genuinely different code, so it is a cross-check rather than the subject grading itself. T2 re-reads chunk_raw FROM THE PROBE rather than re-deriving it here: re-deriving would install a second ruler that drifts the moment the reserve changes. Teeth, in order: T1 the probe partition RECONCILES: skel+pathcap+digits+shahex == reserve. T2 chunk_raw is positive and an exact multiple of 3 (so base64 emits no interior padding). T3 begin's whole-file digest equals an INDEPENDENTLY computed digest of the same bytes. T4 FIXTURE ASSERTION: the large fixture forces nchunks > 1. T5 multi-chunk reassembly is byte-identical to the original. T6 the partition SUMS: the per-chunk raw sizes total exactly total_bytes. T7 NEG-CONTROL: a path-traversal source is REFUSED (exit 4). T8 NEG-CONTROL: a source outside the allowlist is REFUSED (exit 4). T9 NEG-CONTROL: credential material is REFUSED (exit 4). T10 POSITIVE CONTROL: an allowlisted source is ACCEPTED -- without this T7/T9 pass on a guard that refuses everything. T11 an index past end of file is a RANGE refusal (exit 5), distinct from a source refusal. MEASURED 11/11 GREEN 2026-09-03 on the laptop, bite-proven killed=1 with the source and the deployed subject both restored byte-identical (12665 / 40212 bytes). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_base64.nx nx_sha256.nx nx_content_get_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_base64.nxnx_sha256.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ cgg_resolve cgg_exists sys_openat_rd sys_close gv_need gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_puts ↻ gv_num ↻ gv_journal

structs

none

consts

49const CGG_SUBJECT: *u8 = "buildroot/_build/nx_content_get.sov.elf" as *u8
50const CGG_SUBJ_B: *u8 = "_build/nx_content_get.sov.elf" as *u8
51const CGG_SUBJ_C: *u8 = "_offc/nx_content_get.elf" as *u8
52const CGG_SUBJ_D: *u8 = "nx_content_get.elf" as *u8
53const CGG_DIR: *u8 = "/tmp/cgget" as *u8
54const CGG_SMALL: *u8 = "/tmp/cgget/small.bin" as *u8
55const CGG_BIG: *u8 = "/tmp/cgget/big.bin" as *u8
56const CGG_CAP: i64 = 220000
57const CGG_DIGEST: i64 = 32
58const CGG_SHAHEX: i64 = 64
59const CGG_SMALL_N: i64 = 4096
60const CGG_BIG_EXTRA: i64 = 3000
61const CGG_MODE: i64 = 420

functions

63func cgg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: cgg_find
67func cgg_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 2: cgg_int_aftermain calls 1: cgg_slen
83func cgg_int_after(buf: *u8, n: i64, key: *u8) -> i64
called by 1: main calls 1: cgg_find
101func cgg_hex_into(d: *u8, out: *u8) -> i64
called by 1: main
115func cgg_hex_eq(buf: *u8, n: i64, pos: i64, hex: *u8) -> i64
called by 1: main
126func cgg_write_file(path: *u8, buf: *u8, n: i64) -> i64
141func cgg_exists(path: *u8) -> i64
called by 1: cgg_resolve calls 2: sys_openat_rdsys_close
147func cgg_resolve() -> *u8
called by 1: main calls 1: cgg_exists
155func cgg_run(subj: *u8, a1: *u8, a2: *u8, a3: *u8, out: *u8, ol: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
166func main(argc: i64, argv: *i64) -> i64