code wiki / _hdl_build / nx_security_sentinel.nx
nx_security_sentinel.nx
buildroot/runtime/_hdl_build/nx_security_sentinel.nx
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
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
| 22 | const SENT_BUF_MAX: i64 = 4194304 // 4 MiB cap per log read (logs are line-oriented, small) |
| 23 | const SENT_ROWS: i64 = 5 |
functions
| 25 | 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 } |
| 26 | 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 } |
| 27 | func _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 } |
| 28 | func _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 } |
| 29 | func sw_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func sw_read_file(path: *u8, buf: *u8) -> i64 |
| 48 | func sw_count(buf: *u8, n: i64, pat: *u8) -> i64 |
| 65 | func sw_contains(buf: *u8, n: i64, pat: *u8) -> i64 |
| 72 | func sw_max_marked(buf: *u8, n: i64, prefix: *u8) -> i64 |
| 105 | func 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 |
| 107 | func main() -> i64 |