code wiki / (root) / nx_https_truncation_gate.nx

nx_https_truncation_gate.nx

buildroot/runtime/nx_https_truncation_gate.nx

10979 B184 linesdepth 12pulls 42 transitivereach 0 importersview sourcekind gate/prooftopic https
docsdependenciesstructsconstsfunctions

about

nx_https_truncation_gate.nx -- teeth for the TLS-1.3 short-body check in nx_https_get_complete.nx. THE DEFECT IT GUARDS: nx_https_req_complete computed body_target from the peer's Content-Length and then IGNORED IT at three of its four termination exits (record EOF, payload EOF, close_notify alert), so a body the peer cut short returned as a POSITIVE byte count and every caller read positive + 200 as success. The TLS-1.2 sibling leg has checked the same number since 2026-08-18; this gate exists so the 1.3 leg cannot silently lose it again. IN-PROCESS BY CONSTRUCTION: it imports nx_https_get_complete.nx and calls nx_https_body_state, nx_https_body_shortfall and _gc_body_seal DIRECTLY, so it exercises the same code the transport runs rather than parsing a fetcher stdout. That also means it has no NOT-DEPLOYED failure mode -- a gate that forks a deployed elf reports INCONCLUSIVE when the subject is merely un-promoted, which reads as the gate own fault. FIXTURES ARE BYTE BUFFERS ASSEMBLED IN THIS PROCESS, AND THAT IS THE STRONGER FORM OF THE /tmp/<gate>/ LAW, NOT AN EXEMPTION FROM IT. The rule exists because a gate must not share its fixture with a production beat; a buffer that lives and dies inside one process shares nothing with anything, and there is no /tmp file here because there is no FILE anywhere in the code path under test. A gate that wrote a file purely so it could read it back would be testing the filesystem, not the predicate. Every buffer is rebuilt from scratch per tooth, so the gate is idempotent by construction. THE FIRST TOOTH IS THE ANTI-VACUITY ONE. The trivial wrong implementation is "call everything truncated", and it would pass every detection tooth below. Only the positive controls -- complete bodies that must NOT be flagged -- can refute it. A GUARD THAT REFUSES EVERYTHING PASSES EVERY NEGATIVE TEST. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_https_get_complete.nx nx_gate_verdict.nx nx_https_truncation_gate.nx

imports: nx_https_get_complete.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

main gv_head gv_puts sys_write 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 ↻ nx_https_body_state gv_check gv_puts ↻ gv_bite gv_puts ↻ nx_https_body_shortfall nx_https_body_state ↻ _gc_body_seal nx_https_body_state ↻ _gc_e sys_write ↻ _gc_slen _gc_pn sys_mmap ↻ sys_write ↻ nx_https_last_body_state nx_https_last_body_expecte nx_https_last_body_got hg_resp hg_cat

structs

none

consts

none

functions

31func hg_cat(buf: *u8, off: i64, s: *u8) -> i64
called by 1: hg_resp
39func hg_crlf(buf: *u8, off: i64) -> i64
called by 1: hg_resp
48func hg_resp(buf: *u8, declared: *u8, bodylen: i64, xprefix: i64) -> i64
called by 1: main calls 2: hg_cathg_crlf
62func hg_target(buf: *u8, total: i64) -> i64
called by 1: main calls 2: _gc_hdr_end_gc_clen
70func main(argc: i64, argv: *i64) -> i64