code wiki / _hdl_build / nx_mgmt_promote_gate.nx
nx_mgmt_promote_gate.nx
buildroot/runtime/_hdl_build/nx_mgmt_promote_gate.nx
about
nx_mgmt_promote_gate.nx -- prove POST /api/promote (organ ELF) is fail-closed + never-brick. In-process
referee (no socket): crafts request BYTES and feeds the pure handler ma_do_promote. Auth is the SAME
ma_level_of gate as every other write route (proven in nx_mgmt_api_gate), so this focuses on the NEW logic:
T1 NEG daemon target ("sites") -> 400 allowlist, staged file UNTOUCHED (daemons must use /api/deploy)
T2 NEG path-escape ("../etc/x") -> 400 invalid name (sanitize refuses)
T3 NEG missing staged (allowlisted, no .sov.elf.new) -> 400 no-valid-staged, no brick
T4 NEG non-ELF staged (garbage bytes) -> 400 must-be-ELF, live UNTOUCHED (never promote corruption)
T5 NEG no confirm=yes -> 400, staged UNTOUCHED
T6 POS promote -> live == the new ELF, <t>.elf.prev == the old live (never-brick backup), staged consumed
Runs FS under /tmp (WSL-native ext4-like) to avoid 9p flakiness. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
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
structs
| none |
consts
| none |
functions
| 14 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 15 | func pn(v: i64) -> i64 |
| 26 | func glen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 27 | func 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 |
| 28 | func 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 |
| 29 | func gcontains(hay: *u8, n: i64, needle: *u8) -> i64 |
| 41 | func mkreq(dst: *u8, line: *u8, body: *u8) -> i64 |
| 55 | func wfile(path: *u8, buf: *u8, n: i64) -> i64 |
| 63 | func bytes_eq(path: *u8, want: *u8, wn: i64) -> i64 |
| 72 | func file_absent(path: *u8) -> i64 |
| 79 | func main() -> i64 |