code wiki / (root) / nx_atlas_safety.nx

nx_atlas_safety.nx source

↩ module page · 39 lines · 1399 B

1// nx_atlas_safety.nx -- atlas-hygiene SAFETY GUARDRAIL (blueprint Callout 5). 2// Hard keyword tripwire on ontology insertion: a restricted biosecurity/financial-crime footprint token 3// -> BLOCK (exit 5, halt); clean -> ALLOW (exit 0). Explicit small set here; production wires a fuller list. 4// license_tier: ORIGINAL expect_exit: 0 5import "nx_syscalls.nx" 6func as_streq(a: *u8, b: *u8) -> i64 { 7 var i: i64 = 0 8 while a[i] != (0 as u8) { 9 if a[i] != b[i] { return 0 } 10 i = i + 1 11 } 12 if b[i] != (0 as u8) { return 0 } 13 return 1 14} 15func as_hazard(t: *u8) -> i64 { 16 if as_streq(t, "BIOWEAPON" as *u8) == 1 { return 1 } 17 if as_streq(t, "TOXIN" as *u8) == 1 { return 1 } 18 if as_streq(t, "PATHOGEN" as *u8) == 1 { return 1 } 19 if as_streq(t, "NERVE_AGENT" as *u8) == 1 { return 1 } 20 if as_streq(t, "MONEY_LAUNDERING" as *u8) == 1 { return 1 } 21 if as_streq(t, "INSIDER_TRADING" as *u8) == 1 { return 1 } 22 return 0 23} 24func main(argc: i64, argv: *i64) -> i64 { 25 if argc < 2 { 26 sys_write(1, "ATLASSAFETY ERR need token\n" as *u8, 27) 27 sys_exit(2) 28 return 2 29 } 30 let t: *u8 = argv[1] as *u8 31 if as_hazard(t) == 1 { 32 sys_write(1, "ATLASSAFETY BLOCK restricted-footprint-HALT\n" as *u8, 44) 33 sys_exit(5) 34 return 5 35 } 36 sys_write(1, "ATLASSAFETY ALLOW clean\n" as *u8, 24) 37 sys_exit(0) 38 return 0 39}