code wiki / _hdl_build / nx_doc_serve_gate.nx

nx_doc_serve_gate.nx

buildroot/runtime/_hdl_build/nx_doc_serve_gate.nx

6540 B137 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic doc
docsdependenciesstructsconstsfunctions

about

nx_doc_serve_gate.nx -- GATE for LEGAL D3 (nx_doc_serve). Asserts the open-in-app-of-choice serve invariants, each w/ a negative control: T1 CONTENT-TYPE : every format maps to its exact MIME (browser opens the right app). T2 BYTE-EXACT : a body that itself contains CRLFCRLF + NUL round-trips bit-for-bit (Content-Length framed); flipping one body byte is detected. T3 DISPOSITION : DOCX defaults to download (open in Word), PDF inline; the attachment response carries the filename. T4 LENGTH+HARDENING : Content-Length is exact + X-Content-Type-Options:nosniff present (no MIME-sniff of a legal doc). T5 INJECTION-SAFE : a "name\r\nSet-Cookie: ..." filename cannot inject a header -- framing intact AND the CRLF is stripped. T6 SAFE-BY-DEFAULT : an unknown format is octet-stream + attachment (never inlined). T7 TENANT ISOLATION : the vault prefix discipline rejects '.'/'/' tenant ids. Evidence -> knowledge/status/doc_serve.log license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_doc_serve.nx nx_doc_vault.nx nx_syscalls.nx nx_doc_serve_gate.nx

imports: nx_doc_serve.nxnx_doc_vault.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main streq nx_doc_content_type sys_mmap nx_doc_serve_response ds_cat nx_doc_content_type ↻ ds_num sys_mmap ↻ nx_doc_serve_roundtrip_ok ds_body_off nx_doc_default_disposition nx_doc_serve_contains nx_vault_valid_tid ew sys_write ewn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close

structs

none

consts

25const DS_LOG: *u8 = "knowledge/status/doc_serve.log"

functions

27func ew(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
28func ewn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
37func streq(a: *u8, b: *u8) -> i64
called by 1: main
47func main() -> i64