code wiki / _hdl_build / nx_dev_api_gate.nx

nx_dev_api_gate.nx

buildroot/runtime/_hdl_build/nx_dev_api_gate.nx

8515 B144 linesdepth 9pulls 11 transitivereach 0 importersview sourcekind gate/prooftopic dev
docsdependenciesstructsconstsfunctions

about

nx_dev_api_gate.nx -- in-process gate for the sovereign DEV/CI API (nx_dev_api). Drives da_handle with byte requests (NO socket, NO real fork). Proves routing + the TWO boundaries that make it safe to expose: AUTH (object-capability): mutating routes need an X-Nishi-Cap granting "dev_build"; no-cap/forged -> 401. INJECTION: with a VALID cap, the organ name is still charset-validated -> traversal/injection -> 400 BEFORE any exec (fixed-argv). Defence in depth: authority AND input both checked. T1 GET index 200 T2 GET status 200 T3 unknown 404 T4 build NO cap -> 401 T5 build FORGED cap -> 401 T6 build valid-cap + ../etc/passwd -> 400 T7 build valid-cap + empty -> 400 T8 da_valid_name unit T9 da_form_field unit T10 injection charset expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_dev_api.nx nx_dev_api_gate.nx

imports: nx_dev_api.nx

imported by: nobody (leaf or entry point)

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

main gp da_slen sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close da_slen ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real capt_issue capt_payload capt_catb capt_catn signed_cookie_sign sc_sign_bytes sys_mmap ↻ hmac_sha256 sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sha256_update sha256_final sha256_init ↻ sha256_update ↻ sha256_final ↻ b64_encode b64_enc_char da_handle da_body_off da_path_is da_slen ↻ da_index da_http_head da_cat da_cat ↻

structs

none

consts

none

functions

12func gp(s: *u8) -> i64 { sys_write(1, s, da_slen(s)); return 0 }
called by 2: chkmain calls 1: da_slen
13func gpn(v: i64) -> i64 { let b: *u8=sys_mmap(24); let n: i64=da_catn(b,0,v); sys_write(1,b,n); return 0 }
called by 1: main calls 1: da_catn
14func gcontains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: da_slen
19func chk(name: *u8, ok: i64, pass: *i64) -> i64
called by 1: main calls 1: gp
26func mkreq_path(out: *u8, path: *u8, cap: *u8, capl: i64, body: *u8) -> i64
called by 2: mkreqmain calls 3: da_catda_slenda_catn
36func mkreq(out: *u8, cap: *u8, capl: i64, body: *u8) -> i64 { return mkreq_path(out, "/api/dev/build" as *u8, cap, capl, body) }
called by 1: main calls 1: mkreq_path
38func main() -> i64