code wiki / _hdl_build / nx_extvec_authentic_gate.nx
nx_extvec_authentic_gate.nx
buildroot/runtime/_hdl_build/nx_extvec_authentic_gate.nx
about
nx_extvec_authentic_gate.nx -- THE GUARD THAT WOULD HAVE CAUGHT IT ON DAY ONE, PLUS THE LEDGER.
★★★★★ THE LAW THIS GATE ENFORCES:
A DIGEST PIN PROVES INTEGRITY-SINCE-FETCH, NOT AUTHENTICITY-AT-SOURCE.
Every external-vector gate pins its source document to a SHA-256 computed in-process at the socket and
treats "PIN OK" as if it established that the bytes ARE the authority's document. It does not. A pin
proves only that the bytes have not changed since we hashed them. A corrupted, truncated, or -- as
actually happened on 2026-07-31 -- a fetch that stored the raw HTTP WIRE TRANSCRIPT instead of the
document, all pin exactly as cleanly as a good one. The pin is self-consistent BY CONSTRUCTION, so no
amount of re-checking the pin can ever reveal the fault. ★INDEPENDENCE NEEDS A SECOND STACK, NOT A
SECOND HASH.
⚠THE DEFECT THIS EXISTS TO PREVENT: knowledge/extvec/rfc2202.txt began
HTTP/1.1 200 OK\r\nDate: ...\r\nTransfer-Encoding: chunked\r\n ... \r\n\r\n2ea6\r\n
-- 707 bytes of response headers plus chunk framing -- because nx_vecfetch called the raw nx_https_get,
which BY CONTRACT returns the entire response, and never stripped headers or de-chunked. All 14 pinned
"authority documents" were transcripts. The shared decoder (nx_fetch_staged / fu_dechunk in
nx_fetch_unit.nx) already existed and was not adopted. ★THE ADOPTION GAP, NOT A MISSING PRIMITIVE.
TWO INDEPENDENT CHECKS, AND THEY FAIL FOR DIFFERENT REASONS -- THAT IS THE POINT:
A. SHAPE -- is this file a document rather than a transcript? (content predicate, no external input)
B. LEDGER -- does an independent stack agree on this exact file's digest? (corroboration, external)
A catches the accident. B catches the substitution. A file can pass A and fail B (a DIFFERENT but
well-formed document swapped in), or pass B and fail A (both stacks fetched the same transcript).
★A SINGLE CHECK THAT COULD HAVE CAUGHT BOTH WOULD HAVE CAUGHT NEITHER CLEANLY.
⚠HONEST LIMIT OF THE LEDGER, STATED SO NOBODY OVER-TRUSTS IT: CORROBORATION.tsv is a plain file this
agent can write. It raises the bar -- swapping a document now requires forging a matching "independent"
column, at which point that column is no longer independent and the forgery is recorded in-tree rather
than invisible -- but it is NOT a transparency log. The July-2026 answer to that is Sigstore/Fulcio/Rekor
or in-toto/DSSE: an append-only log held by a party we cannot edit. Nishi already has nx_coe_dsse /
nx_coe_intoto / nx_coe_witness and this lane has NOT adopted them. That is the next rung, not this one.
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_sha256_wasm.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 116 | const F_OK: i64 = 0 |
| 117 | const F_STATUSLINE: i64 = 1 |
| 118 | const F_HDR_TE: i64 = 2 |
| 119 | const F_HDR_CL: i64 = 3 |
| 120 | const F_HDR_BREAK: i64 = 4 |
| 121 | const F_CR: i64 = 5 |
| 147 | const L_OK: i64 = 0 |
| 148 | const L_NOROW: i64 = 1 |
| 149 | const L_SOVMISS: i64 = 2 |
| 150 | const L_INDEPMISS: i64 = 3 |
| 151 | const L_NOTAGREED: i64 = 4 |
| 152 | const L_SHORT: i64 = 5 |
functions
| 38 | func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 39 | func wb(b: *u8, n: i64) -> i64 { sys_write(1, b, n); return 0 } calls 1: sys_write |
| 41 | func nn(v: i64) -> i64 |
| 55 | func hexnib(v: i64) -> i64 { if v < 10 { return 48 + v } return 87 + v } called by 1: hexdig |
| 57 | func starts(b: *u8, n: i64, at: i64, s: *u8) -> i64 |
| 67 | func findfrom(b: *u8, n: i64, s: *u8, from: i64) -> i64 |
| 76 | func lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } |
| 77 | func find_ci(b: *u8, n: i64, lim: i64, s: *u8) -> i64 |
| 94 | func count_byte(b: *u8, n: i64, v: i64) -> i64 called by 1: transcript_fault |
| 101 | func mkpath(name: *u8, out: *u8) -> i64 called by 1: main |
| 123 | func transcript_fault(b: *u8, n: i64) -> i64 |
| 136 | func faultname(f: i64) -> i64 |
| 157 | func ledger_check(led: *u8, ln: i64, name: *u8, filedig: *u8) -> i64 |
| 197 | func ledgername(f: i64) -> i64 |
| 207 | func hexdig(b: *u8, n: i64, out: *u8) -> i64 |
| 221 | func main() -> i64 |