code wiki / _hdl_build / nx_security_sentinel.nx

nx_security_sentinel.nx

buildroot/runtime/_hdl_build/nx_security_sentinel.nx

9787 B206 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic security
docsdependenciesstructsconstsfunctions

about

nx_security_sentinel.nx -- the team's SECURITY SENTINEL role unit. ONE VERB: WATCH. (RACI clean partition: Engineer VERIFIES, Doctor HEALS, Auditor GRADES maturity, security_status OBSERVES posture -- nobody WATCHED the signal stream. This does.) What it does, every run: 1. Reads the durable issues log (knowledge/status/issues_durable.log). 2. Walks a DATA-DRIVEN WATCH TABLE (pattern, threshold, key) -- counts occurrences. 3. For each row at/over threshold, checks its own log for a SENTINEL-RESOLVE line: "SENTINEL-RESOLVE key=<KEY> at=<N>" -- resolved iff N >= current count (signal grew past the resolve mark => RE-ESCALATES; stale resolves don't mask). 4. Unresolved escalations are appended ONCE (idempotent: skip if the exact PM-ESCALATION key line already exists) to knowledge/status/pm_plan_durable.log. 5. Emits one SENTINEL line per row + one SENTINEL-VERDICT line to knowledge/status/security_sentinel.log. Exit 0 = no active escalation, 1 = ATTENTION. Adding coverage = adding a table row (build intelligence, never strip). Resolving = appending "SENTINEL-RESOLVE key=<KEY> at=<count>" to the sentinel log after the named defect's regression gate is green (Engineer's verify, not ours). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_security_sentinel.nx

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

main _p sys_write sys_mmap sw_read_file sys_openat_rd sys_read sys_close sys_exit sys_openat_append _fp sys_write ↻ _fn sys_mmap ↻ sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sw_count sw_slen sw_cat sw_max_marked sw_slen ↻ _pn sys_mmap ↻ sys_write ↻ sw_contains sw_count ↻ sys_close ↻

structs

none

consts

22const SENT_BUF_MAX: i64 = 4194304 // 4 MiB cap per log read (logs are line-oriented, small)
23const SENT_ROWS: i64 = 5

functions

25func _p(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
26func _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 }
called by 1: main calls 2: sys_mmapsys_write
27func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
28func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; 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(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
29func sw_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
32func sw_read_file(path: *u8, buf: *u8) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
48func sw_count(buf: *u8, n: i64, pat: *u8) -> i64
called by 2: sw_containsmain calls 1: sw_slen
65func sw_contains(buf: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: sw_count
72func sw_max_marked(buf: *u8, n: i64, prefix: *u8) -> i64
called by 1: main calls 1: sw_slen
105func sw_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
107func main() -> i64