code wiki / _hdl_build / nx_pkg_gate.nx
nx_pkg_gate.nx
buildroot/runtime/_hdl_build/nx_pkg_gate.nx
about
nx_pkg_gate.nx -- THE GATE FOR THE CONTENT-ADDRESSED PACKAGE LANE (LR3 of /compare/lang).
Subject: the DEPLOYED nx_pkg binary (fork-style end-to-end; argv[1] overrides the subject path so a
mutation bite can aim at a staged mutant without touching live). Every fixture is assembled AT
RUNTIME in /tmp/nx_pkg_gate/ -- nothing is checked in, so a source scanner can never find this gate's
own bad inputs, and setup is idempotent so a rerun cannot inherit a prior run's artifacts.
WHAT IT PROVES, AND WHY EACH TOOTH EXISTS:
A GUARD THAT REFUSES EVERYTHING PASSES EVERY NEGATIVE TEST. So every refusal tooth here is paired
with a POSITIVE CONTROL that MUST be allowed, and every refusal asserts WHICH RULE FIRED -- both
the rule name on stdout and the distinct exit code. A suite that only asks `was it refused?` is
blind by construction, and this estate has already shipped that exact defect once (four SSRF deny
tests green while the guard refused every url).
ZERO INSTALL-TIME EXECUTION is proven MECHANICALLY, never asserted. The module fixture carries a
real would-be install hook, and the gate first RUNS that hook itself to prove it genuinely produces
an observable marker (the anti-vacuity control -- otherwise `the marker is absent` proves only that
the marker was never producible). The marker is then cleared, the same module resolved through the
subject, and the marker asserted ABSENT while the resolve itself SUCCEEDED.
NOT ROSTER-ADMITTED BY DEFAULT: it forks the subject ~25 times. Run via nx_job_run or /api/gate_run.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_sha256.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
| 27 | const PG_SUBJECT_DEFAULT: *u8 = "./nx_pkg.elf" as *u8 |
| 28 | const PG_DIR: *u8 = "/tmp/nx_pkg_gate" as *u8 |
| 29 | const PG_STORE: *u8 = "/tmp/nx_pkg_gate/store" as *u8 |
| 30 | const PG_CONF: *u8 = "/tmp/nx_pkg_gate/pkg_cas.conf" as *u8 |
| 31 | const PG_CONF_BAD: *u8 = "/tmp/nx_pkg_gate/bad_missing_key.conf" as *u8 |
| 32 | const PG_LOCK: *u8 = "/tmp/nx_pkg_gate/pkg.lock" as *u8 |
| 33 | const PG_JRNL: *u8 = "/tmp/nx_pkg_gate/pkgcas.jrnl" as *u8 |
| 34 | const PG_OUT: *u8 = "/tmp/nx_pkg_gate/capture.txt" as *u8 |
| 35 | const PG_MOD_HOOK: *u8 = "/tmp/nx_pkg_gate/mod_with_install_hook.nx" as *u8 |
| 36 | const PG_MOD_SQUAT: *u8 = "/tmp/nx_pkg_gate/mod_typosquat.nx" as *u8 |
| 37 | const PG_PWN_CONF: *u8 = "/tmp/nx_pkg_gate/pwn_conf.conf" as *u8 |
| 38 | const PG_PWN_PAYLOAD: *u8 = "/tmp/nx_pkg_gate/pwn_payload.txt" as *u8 |
| 39 | const PG_PWN_MARKER: *u8 = "/tmp/nx_pkg_gate/PWNED" as *u8 |
| 40 | const PG_PWN_LOCK: *u8 = "/tmp/nx_pkg_gate/pwn.lock" as *u8 |
| 41 | const PG_PWN_STORE: *u8 = "/tmp/nx_pkg_gate/pwnstore" as *u8 |
| 42 | const PG_DEST_OK: *u8 = "/tmp/nx_pkg_gate/resolved_hook.nx" as *u8 |
| 43 | const PG_DEST_GOOD: *u8 = "/tmp/nx_pkg_gate/resolved_pinned.nx" as *u8 |
| 44 | const PG_DEST_SQUAT: *u8 = "/tmp/nx_pkg_gate/resolved_squat.nx" as *u8 |
| 45 | const PG_DEST_MISMATCH: *u8 = "/tmp/nx_pkg_gate/resolved_mismatch.nx" as *u8 |
| 46 | const PG_DEST_OUTSIDE: *u8 = "/etc/nx_pkg_gate_should_never_appear" as *u8 |
| 48 | const PG_NAME_REAL: *u8 = "nx_syscalls" as *u8 |
| 49 | const PG_NAME_SQUAT: *u8 = "nx_sysca11s" as *u8 |
| 51 | const PG_SHAHEX: i64 = 64 |
| 52 | const PG_DIGEST_BYTES: i64 = 32 |
| 53 | const PG_NL: i64 = 10 |
| 54 | const PG_BAR: i64 = 124 |
| 55 | const PG_ASCII_0: i64 = 48 |
| 56 | const PG_ASCII_9: i64 = 57 |
| 57 | const PG_SCRATCH: i64 = 4096 |
| 58 | const PG_MODE_X: i64 = 493 |
| 61 | const PG_EXIT_USAGE: i64 = 3 |
| 62 | const PG_EXIT_CONF: i64 = 4 |
| 63 | const PG_EXIT_MALFORMED: i64 = 5 |
| 64 | const PG_EXIT_ABSENT: i64 = 6 |
| 65 | const PG_EXIT_MISMATCH: i64 = 7 |
| 66 | const PG_EXIT_DEST: i64 = 8 |
| 67 | const PG_EXIT_NOTPINNED: i64 = 9 |
| 68 | const PG_EXIT_PINCONFLICT: i64 = 10 |
| 69 | const PG_EXIT_CHAIN: i64 = 11 |
| 70 | const PG_EXIT_PINAMBIG: i64 = 13 |
functions
| 72 | func pg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 73 | func pg_mkdir(path: *u8) -> i64 |
| 80 | func pg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 81 | func pg_cat(d: *u8, o: i64, s: *u8) -> i64 { var p: i64 = o; var i: i64 = 0; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p } |
| 82 | func pg_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 94 | func pg_write_str(path: *u8, s: *u8) -> i64 { return pg_write(path, s, pg_slen(s)) } |
| 95 | func pg_find(hay: *u8, n: i64, needle: *u8) -> i64 |
| 108 | func pg_num_after(hay: *u8, n: i64, key: *u8) -> i64 |
| 125 | func pg_hex_into(dig: *u8, out: *u8) -> i64 called by 1: pg_file_sha |
| 134 | func pg_file_sha(path: *u8, outhex: *u8) -> i64 |
| 146 | func pg_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, nargs: i64) -> i64 |
| 167 | func pg_read_out(lp: *i64) -> *u8 |
| 173 | func pg_saw_rule(rule: *u8) -> i64 |
| 186 | func main(argc: i64, argv: *i64) -> i64 |