nx_tools_api_exec_gate.nx
buildroot/runtime/nx_tools_api_exec_gate.nx
about
nx_tools_api_exec_gate.nx -- GATE for R2: the /mcp tools/call STUB is now REAL execution. Drives the live
pure router ta_handle_pfx IN-PROCESS (no socket) and proves, end-to-end, that a capability-authorized
tools/call for a GREEN-allowlisted tool actually FORKS the organ and returns its real stdout -- with the
two never-brick negative controls that make this safe: (T2) no capability -> JSON-RPC -32001 (nothing
runs), (T3) a valid capability for a tool that is NOT on the GREEN execution allowlist -> tool-level error,
NOT executed. Composes R0 (nx_tool_run) + R1 (nx_tool_exec_allow) + the cap-token ocap layer.
PREREQ: build nx_tool_ping FIRST (produces _offc/nx_tool_ping.elf, the allowlisted target). This gate
writes the real allowlist file (tool_allowlist.conf) in the server CWD, since ta_mcp_call resolves through
the production TEA_CONF path -- proving the ACTUAL wired path, not a test shim.
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_tools_api.nxnx_gate.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
| 15 | const EG_CONF: *u8 = "tool_allowlist.conf" as *u8 |
| 16 | const EG_PINGELF: *u8 = "_offc/nx_tool_ping.elf" as *u8 |
functions
| 18 | func eg_cat(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 } |
| 19 | func eg_catb(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 } |
| 20 | func eg_has(out: *u8, n: i64, needle: *u8) -> i64 { if ta_indexof(out, n, needle) >= 0 { return 1 } return 0 } |
| 21 | func eg_write_file(path: *u8, content: *u8) -> i64 called by 1: main |
| 30 | func eg_write_conf() -> i64 called by 1: main |
| 40 | func eg_build_call(req: *u8, tool: *u8, tok: *u8, tlen: i64) -> i64 |
| 52 | func eg_build_call_argv(req: *u8, tool: *u8, tok: *u8, tlen: i64, argvj: *u8) -> i64 |
| 66 | func eg_build_call_bearer(req: *u8, tool: *u8, tok: *u8, tlen: i64) -> i64 |
| 76 | func main() -> i64 |