code wiki / _hdl_build / nx_mgmt_cap_mint_gate.nx

nx_mgmt_cap_mint_gate.nx

buildroot/runtime/_hdl_build/nx_mgmt_cap_mint_gate.nx

7681 B140 linesdepth 18pulls 72 transitivereach 0 importersview sourcekind gate/prooftopic mgmt
docsdependenciesstructsconstsfunctions

about

nx_mgmt_cap_mint_gate.nx -- prove POST /api/cap/mint is fail-closed least-authority. In-process referee (no socket): crafts request BYTES, feeds the pure handler ma_do_cap_mint. Auth is the SAME ma_level_of gate as every other write route, so this focuses on the NEW logic: T1 missing allow -> 400 T2 allow=* -> 400 (charset refuses the mint-everything cap BY CONSTRUCTION) T3 malformed csv (a,,b) -> 400 T4 allow names an UNREGISTERED tool -> 400 (a cap can never pre-authorize a phantom tool) T5 no confirm=yes -> 400 T6 days out of range -> 400 T7 FAIL-CLOSED oracle: valid multi-element allow + confirm, but the on-NAS minter elf is absent locally -> oracle exit != 0 -> 400 "mint failed", NO token, and NO cap_consent.log audit line (nothing minted). (The positive mint is proven LIVE post-deploy -- the oracle + keyfile are NAS-absolute by design.) Runs FS under /tmp. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_mgmt_api.nx nx_syscalls.nx nx_mgmt_cap_mint_gate.nx

imports: nx_mgmt_api.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 w sys_write sys_mkdir sys_chdir sys_mmap sys_mmap ↻ wfile sys_openat_wr sys_write ↻ sys_close glen mkreq glen ↻ gcat sys_mmap ↻ gcatn ma_do_cap_mint sd_body_off sd_form_field ma_emit_400 sd_cat ma_emit_json sd_cat ↻ sd_catn sys_mmap ↻ md_allow_has_name sys_openat_rd sys_mmap ↻ sys_read sys_close ↻ md_len sd_cat ↻ md_slice_atoi sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real ma_confirmed sd_body_off ↻ sd_form_field ↻

structs

none

consts

none

functions

17func w(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 1: main calls 1: sys_write
18func pn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
27func glen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 3: gcontainsmkreqmain
28func gcat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o+i]=s[i]; i=i+1} return o+i }
called by 1: mkreq
29func gcatn(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64=0; while i<n {d[o+i]=s[i]; i=i+1} return o+n }
called by 1: mkreq
30func gcontains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: glen
41func mkreq(dst: *u8, line: *u8, bod: *u8) -> i64
called by 1: main calls 4: glengcatsys_mmapgcatn
54func wfile(path: *u8, buf: *u8, n: i64) -> i64
58func fsize(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
65func main() -> i64