nx_content_put_client_gate.nx
buildroot/runtime/nx_content_put_client_gate.nx
about
nx_content_put_client_gate.nx -- THE GATE FOR THE SOVEREIGN UPLOAD CLIENT, 2026-09-03.
SUBJECT: the BUILT nx_content_put_client elf, forked in `dryrun` mode so the JSON-RPC envelope it
would put on the wire becomes a deterministic artifact with no socket involved.
WHY dryrun IS THE RIGHT SUBJECT. A malformed envelope is rejected by the SERVER, and the server's
refusal names neither the client nor the real fault -- it reports a schema or argument error about a
request nobody can see. The first draft of CC_PRE carried a DOUBLED "params" key with a four-brace
tail that balanced against itself: syntactically valid JSON of entirely the wrong SHAPE. Nothing in a
live run would have named that. T2 exists precisely for it.
T3 IS AN EXTERNAL KAT, NOT OUR OWN ARITHMETIC. The fixture is the three bytes "abc", whose SHA-256 is
published in FIPS 180-2 as ba7816bf...f20015ad. The client computes the digest it sends with our
sha256, and the gate compares against the PUBLISHED constant -- so this tooth cannot pass by our
implementation agreeing with itself. If our sha256 were wrong, every upload would carry a digest the
server would reject at commit, and this is the cheapest possible place to catch that.
T6/T7 ARE THE REFUSAL PAIR. T6 requires a destination carrying a double-quote to be REFUSED rather
than escaped -- the client's stated design is refuse-never-escape, because a hand-rolled JSON escaper
is wrong in exactly the cases nobody tests. On its own T6 would pass on a client that refused
everything, so T7 requires a safe destination to be ACCEPTED.
Teeth, in order:
T1 the envelope's braces and brackets balance, and it ends with the declared tail.
T2 "params" appears EXACTLY ONCE (the doubled-key defect that shipped in the first draft).
T3 EXTERNAL KAT: the digest sent for "abc" is the FIPS 180-2 published SHA-256.
T4 the destination appears verbatim in the envelope.
T5 the capability token appears verbatim (a client that dropped it would 401 for the wrong reason).
T6 NEG-CONTROL: a destination containing a quote is REFUSED (exit 4), never escaped.
T7 POSITIVE CONTROL: a safe destination is ACCEPTED (exit 0), so T6 cannot pass on a client that
refuses everything.
T8 the argv array's first element is the verb "begin".
MEASURED 8/8 GREEN 2026-09-03: braces 3/3, brackets 1/1, params key exactly once, FIPS vector present,
quote-in-destination refused at exit 4 with the safe destination accepted at exit 0.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 40 | const CPG_S_A: *u8 = "buildroot/_build/nx_content_put_client.sov.elf" as *u8 |
| 41 | const CPG_S_B: *u8 = "_build/nx_content_put_client.sov.elf" as *u8 |
| 42 | const CPG_S_C: *u8 = "_offc/nx_content_put_client.elf" as *u8 |
| 43 | const CPG_S_D: *u8 = "nx_content_put_client.elf" as *u8 |
| 44 | const CPG_DIR: *u8 = "/tmp/cpcli" as *u8 |
| 45 | const CPG_FIX: *u8 = "/tmp/cpcli/abc.bin" as *u8 |
| 46 | const CPG_CAPF: *u8 = "/tmp/cpcli/cap.txt" as *u8 |
| 47 | const CPG_CAP: i64 = 65536 |
| 48 | const CPG_MODE: i64 = 420 |
| 50 | const CPG_KAT: *u8 = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" as *u8 |
| 51 | const CPG_DEST: *u8 = "knowledge/fetched/cpcli_probe.bin" as *u8 |
| 52 | const CPG_CAPTOK: *u8 = "tok~1~abcDEF.ghi-jkl" as *u8 |
| 53 | const CPG_URL: *u8 = "https://example.invalid/api/tools/call" as *u8 |
| 54 | const CPG_LBRACE: i64 = 123 |
| 55 | const CPG_RBRACE: i64 = 125 |
| 56 | const CPG_LBRACK: i64 = 91 |
| 57 | const CPG_RBRACK: i64 = 93 |
functions
| 59 | func cpg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 61 | func cpg_count(buf: *u8, n: i64, needle: *u8) -> i64 |
| 77 | func cpg_has(buf: *u8, n: i64, needle: *u8) -> i64 |
| 81 | func cpg_byte_count(buf: *u8, n: i64, b: i64) -> i64 |
| 87 | func cpg_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 101 | func cpg_exists(p: *u8) -> i64 |
| 107 | func cpg_resolve() -> *u8 |
| 114 | func cpg_run(subj: *u8, dest: *u8, out: *u8, ol: *i64) -> i64 |
| 126 | func main(argc: i64, argv: *i64) -> i64 |