code wiki / _hdl_build / nx_cms_register.nx

nx_cms_register.nx source

↩ module page · 43 lines · 3498 B

1// nx_cms_register.nx -- registers the CMS arc capabilities. Engineer gate = the three artifact 2// gates REBUILT + re-run GREEN right here via nx_sov_build_run (prove-all doctrine: never depend 3// on prebuilt /tmp binaries -- /tmp is contested by parallel sessions and dies on reboot). 4// license_tier: ORIGINAL 5import "nx_cap_register.nx" 6import "nx_syscalls.nx" 7 8func cmr_build_run(name: *u8) -> i64 { 9 let pid: i64 = sys_fork() 10 if pid == 0 { 11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 13 let argvv: *i64 = sys_mmap(32) as *i64 14 argvv[0] = "_offc/nx_sov_build_run.elf" as *u8 as i64 15 argvv[1] = name as i64 16 argvv[2] = 0 17 let envp: *i64 = sys_mmap(16) as *i64 18 envp[0] = 0 19 sys_execve("_offc/nx_sov_build_run.elf" as *u8, argvv, envp); sys_exit(127) 20 } 21 let st: *i64 = sys_mmap(16) as *i64 22 sys_wait4(pid, st, 0) 23 return st[0] 24} 25 26func main() -> i64 { 27 var allok: i64 = 1 28 if cmr_build_run("nx_html_sanitize_test" as *u8) != 0 { allok = 0 } 29 if cmr_build_run("nx_cms_c2_test" as *u8) != 0 { allok = 0 } 30 if cmr_build_run("nx_cms_gate" as *u8) != 0 { allok = 0 } 31 cr_w(1, "ENGINEER: sanitizer+c2+e2e gates all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 32 let eng: i64 = ig_engineer(1, 1, 1, allok) 33 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 34 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 35 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 36 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 37 cr_write_entry(fd, 269, 2, "GEN CMS-CONTENT-MODEL (ladder steps 3+9+10) -- the WordPress content/theme split, sovereign: nx_secure_token (128b urandom hex + ct-eq), nx_html_sanitize KSES-style ALLOWLIST keystone (allowlist tags table-driven, attrs dropped except a@href scheme-checked POST-FILTER, script/style content stripped, stray < escaped, quote-aware tag-end; 19/19 real-XSS-vector KATs) + nx_cms_store (@key record store, atomic temp+renameat publish, .prev one-deep revision, rollback; rule-13 additive) + nx_cms_render ({{key}} templates, _html raw-after-sanitize vs plain ESCAPED at render = sanitize-on-write AND escape-on-render). KATs nx_cms_c2_test ALL GREEN. Found+filed NX-CC-CONST-INDEX-PARSE + NX-CC-ARITY-LAX" as *u8, 2) 38 cr_write_entry(fd, 270, 2, "GEN CMS-ADMIN-EDITOR (C3+C4+C5, the WYSIWYG human-engagement surface) -- nx_cms_admin daemon: field-based editor (labelled inputs + rich textarea per content key, legal-staff UX per spec), session auth (sha256 pw file + HttpOnly SameSite=Strict cookie + 5-strike lockout + ct-compare), CSRF synchronizer token, sanitize-on-write, ATOMIC publish renders page.html hot, rollback GUARDED by the team-authored _pe_pub STATE_FLOW core (CAPREG241 composed in production). PROVEN by nx_cms_gate = the spec acceptance criteria mechanized: 11 rows own-HTTP-client attacker+editor journey (unauth refused, CSRF forged refused, stored <script> GONE while <b> kept, edit LIVE, rollback restores prior publish) = 11/11 permil=1000 -> knowledge/status/cms_gate.log. Loopback v1; NEXT rungs filed: sites-daemon TLS integration, C7 multi-site isolation, draft-preview mode, vault-managed pw, argon2id (blocked CRYPTO-RUNTIME-DEFECT)" as *u8, 2) 39 sys_close(fd) 40 cr_w(1, "CAPREG idx=269,270 REGISTERED (CMS arc gated)\n" as *u8) 41 sys_exit(0) 42 return 0 43}