code wiki / _hdl_build / nx_page_verify.nx

nx_page_verify.nx

buildroot/runtime/_hdl_build/nx_page_verify.nx

21766 B446 linesdepth 21pulls 149 transitivereach 0 importersview sourcekind orphan librarytopic page
docsdependenciesstructsconstsfunctions

about

nx_page_verify.nx -- BROWSER-GRADE LIVE PAGE VERIFIER (the "my verify was shit" cure, operator 2026-07-16). Status-200-on-the-page is NOT verification: a page can 200 while every image on it is broken (the /render3d incident: the edge 301-strips trailing slashes, so RELATIVE img srcs resolve to the site root -> 404/fallback -> broken images that a direct asset fetch never catches). This organ verifies a page THE WAY A BROWSER EXPERIENCES IT: 1. fetch the page (sovereign TLS, redirects followed) -- must be 200 2. extract every asset ref (img/script src=, link href=) 3. LAW CHECK: a RELATIVE asset ref = RED by construction on our slash-stripping edge (use absolute /path) 4. fetch every same-origin asset -- 200 required 5. DEEP-DECODE: PNG assets run through the full sovereign decoder (nx_png_decode: signature, IHDR, zlib inflate, unfilter incl Paeth) -- "200 + magic bytes" is not proof; DECODED WxH is 6. an asset that answers with HTML (the 404-fallback class) = RED even though its status is 200 Composes nx_https_fetch_follow (the games_url_check fetch spine) + nx_png_decode. Exit = broken count. usage: nx_page_verify <https-url> [connect-host:port] (run from repo root: needs data/mozilla_certdata.txt) [connect-host:port] = OPTIONAL connect-override (curl --connect-to): page + every asset fetch opens TCP+TLS to THIS endpoint while SNI/Host/cert-name stay the URL host -- use 127.0.0.1:8443 to verify our OWN vhosts deterministically from the sovereign edge (kills the DSM-nginx :443 coin-flip false-RED). license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_url_connect.nx nx_https_fetch_follow.nx nx_png_decoder.nx nx_page_verify.nx

imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_url_connect.nxnx_https_fetch_follow.nxnx_png_decoder.nx

imported by: nobody (leaf or entry point)

structs

none

consts

26const PV_CAP: i64 = 8388608 // the EYE must out-read the pages it audits (the 2MiB-truncation lesson)
27const PV_MAXREF: i64 = 64
31const PV_CERTDATA_CAP: i64 = 4194304 // trust-store parse arena for mozilla_certdata.txt
32const PV_URL_CAP: i64 = 4096 // one absolute URL (origin, and each resolved ref)
33const PV_REF_MAX: i64 = 2048 // longest relative ref we will resolve
34const PV_FULLURL_CAP: i64 = 8192 // origin + ref joined
161const PV_DOMCONF: *u8 = "knowledge/registry/our_domains.conf"
162const PV_DOMCAP: i64 = 65536
163const PV_EP_CAP: i64 = 256

functions

36func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: pv_check_assetpv_host calls 1: sys_write
37func pn(v: i64) -> i64 { let t: *u8=sys_mmap(24); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} let b: *u8=sys_mmap(24); var j: i64=0; while j<k{b[j]=t[k-1-j];j=j+1} sys_write(1,b,k); return 0 }
38func pw(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 }
calls 1: sys_write
40func sw_starts(b: *u8, off: i64, lit: *u8) -> i64
47func pv_origin(url: *u8, out: *u8) -> i64
63func pv_check_asset(store: *TrustStore, aurl: *u8, body: *u8) -> i64
108func pv_has(b: *u8, n: i64, lit: *u8) -> i64
calls 1: sw_starts
113func pv_count(b: *u8, n: i64, lit: *u8) -> i64
calls 1: sw_starts
121func pv_hskip(b: *u8, n: i64) -> i64
142func pv_pfx(s: *u8, pfx: *u8) -> i64
166func pv_host(url: *u8, out: *u8, cap: i64) -> i64
191func pv_dom_lookup(host: *u8, ep: *u8, epcap: i64) -> i64
248func pv_atoi(a: *u8) -> i64
259func main(argc: i64, argv: *i64) -> i64