code wiki / _hdl_build / nx_mgmt_tools_register_gate.nx

nx_mgmt_tools_register_gate.nx

buildroot/runtime/_hdl_build/nx_mgmt_tools_register_gate.nx

13401 B221 linesdepth 18pulls 86 transitivereach 0 importersview sourcekind gate/prooftopic mgmt
docsdependenciesstructsconstsfunctions

about

nx_mgmt_tools_register_gate.nx -- prove POST /api/tools/register is fail-closed + idempotent. In-process referee (no socket): crafts request BYTES, feeds the pure handler ma_do_tools_register. Auth is the SAME ma_level_of gate as every other write route, so this focuses on the NEW logic: T1 missing name -> 400 T2 path-escape elf basename ("../x") -> 400 invalid basename (sanitize refuses) T3 no confirm=yes -> 400 T4 IDEMPOTENT: a name already in tool_allowlist.conf -> ALREADY-REGISTERED, file UNCHANGED (no dup row) T5 elf not a real ELF under nishihost -> 400 (never register a phantom tool) (The positive append is proven LIVE post-deploy -- its ELF path is the NAS-absolute nishihost dir.) Runs FS under /tmp. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_mgmt_api.nx nx_syscalls.nx nx_gate_verdict.nx nx_mgmt_tools_register_gate.nx

imports: nx_mgmt_api.nxnx_syscalls.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 w sys_write sys_mkdir sys_chdir 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 ↻ sys_mmap ↻ wfile sys_openat_wr sys_write ↻ sys_close glen fsize sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ mkreq glen ↻ gcat sys_mmap ↻ gcatn

structs

none

consts

16const GT_ARGCAP: i64 = 4096

functions

18func 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
19func pn(v: i64) -> i64
28func glen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 3: gcontainsmkreqmain
29func 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
30func 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
31func gcontains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: glen
42func mkreq(dst: *u8, line: *u8, bod: *u8) -> i64
called by 1: main calls 4: glengcatsys_mmapgcatn
55func wfile(path: *u8, buf: *u8, n: i64) -> i64
59func fsize(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
66func main() -> i64