code wiki / _hdl_build / nx_secret_scan_gate.nx
nx_secret_scan_gate.nx
buildroot/runtime/_hdl_build/nx_secret_scan_gate.nx
about
nx_secret_scan_gate.nx -- re-runnable GATE for nx_secret_scan + the self-manage closure.
(Engineer verb: VERIFY. Team-built, hardware up -- replaces a bash gate, per operator law:
no sh/py; capabilities are built INTO the team.)
KATs (fixture work uses an ALT issues log in /tmp so the production signal stream the
sentinel watches is never polluted by plants):
K1 clean tree -> scan(alt) exit 0
K2 planted PW-literal fixture -> scan(alt) exit 1
K3 alt issues log NAMES the planted file with the PLAINTEXT-SECRET marker
K4 fixture removed -> scan(alt2) exit 0 again (returns-to-green, tree left clean)
K5 planted EMPTY literal (PW="" shred idiom) -> exit 0 (intelligence: hygiene != leak)
Then the SELF-MANAGE closure:
P1 production scan (real issues log). GREEN posture required for gate green.
P2 if prod is green and the issues-log count grew past the last SENTINEL-RESOLVE mark,
append "SENTINEL-RESOLVE key=PLAINTEXT-SECRET at=<count>" (idempotent: only when
count > mark) -- the Engineer's verify IS the resolve evidence.
P3 re-run the security sentinel to refresh posture (its verdict is its own; reported).
Exit 0 = 4/4 KATs + prod GREEN. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_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
| 21 | const GG_BUF_MAX: i64 = 4194304 |
| 22 | const AT_FDCWD: i64 = 0 - 100 |
functions
| 24 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 25 | func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 26 | func gg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 27 | func gg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } called by 1: main |
| 28 | func gg_unlink(path: *u8) -> i64 { __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) return 0 } called by 1: main |
| 30 | func gg_read(path: *u8, buf: *u8) -> i64 |
| 45 | func gg_count(buf: *u8, n: i64, pat: *u8) -> i64 |
| 62 | func gg_max_marked(buf: *u8, n: i64, prefix: *u8) -> i64 |
| 96 | func gg_run(path: *u8, a1: *u8) -> i64 |
| 116 | func gg_write(path: *u8, content: *u8) -> i64 |
| 124 | func main() -> i64 |