code wiki / _hdl_build / nx_email_portal_gate.nx
nx_email_portal_gate.nx
buildroot/runtime/_hdl_build/nx_email_portal_gate.nx
about
nx_email_portal_gate.nx -- SOVEREIGN in-process referee for the mail.<domain> EMAIL portal daemon
(no socket/curl/shell). Arms a fresh realm + invite store, then feeds crafted HTTP request BYTES into
the pure router epd_handle and asserts response bytes AND real mailbox side effects in the seg_store:
T1 GET / -> 200 + the login/register/mail SPA shell
T2 invite register alice -> 200 mnemonic; then login -> token A
T3 NEG bad-charset handle -> 400 AND the invite is NOT consumed (proved by T4 using it)
T4 register bob with T3's invite -> 200 (the invite survived the refused attempt); login -> token B
T5 NEG /mail/inbox with NO session -> 401
T6 alice sends bob a message whose subject carries "<script>" -> 200 DELIVERED-LOCAL + bob count +1
T7 bob's inbox fragment shows the subject HTML-ESCAPED (<script>), raw <script> ABSENT
T8 bob reads the message -> body marker present, escaped
T9 ISOLATION: alice's inbox does NOT contain bob's subject (mailbox derives from the session only)
T10 alice sends to an EXTERNAL rcpt -> 200 QUEUED-EXTERNAL + relay-queue@<domain> count +1 (honest)
T11 bob deletes the message -> inbox fragment no longer lists it; slot reads tombstoned
T12 GET /mail/whoami (token A) -> {"handle":"alice","mailbox":"alice@<domain>"}
GREEN iff 12/12. Appends knowledge/status/email_portal_gate.log. license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_email_portal_daemon.nxnx_modern_auth_flow.nxnx_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
| none |
functions
| 21 | func g_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 22 | func g_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 23 | func g_lw(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 } |
| 24 | func g_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } return o + i } called by 1: main |
| 25 | func g_cat_n(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { d[o + i] = s[i]; i = i + 1 } return o + n } called by 1: main |
| 26 | func g_trunc(path: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, 0x180); if fd >= 0 { sys_close(fd) } return 0 } |
| 27 | func g_starts(buf: *u8, n: i64, s: *u8) -> i64 { let sn: i64 = g_len(s); if n < sn { return 0 } var i: i64 = 0; while i < sn { if (buf[i] as i64) != (s[i] as i64) { return 0 } i = i + 1 } return 1 } |
| 28 | func g_contains(hay: *u8, n: i64, needle: *u8) -> i64 |
| 33 | func g_extract_token(resp: *u8, n: i64, out: *u8) -> i64 called by 1: main |
| 42 | func g_verdict(label: *u8, ok: i64) -> i64 { g_w(" " as *u8); g_w(label); if ok == 1 { g_w(" PASS\n" as *u8) } else { g_w(" FAIL\n" as *u8) } return ok } |
| 44 | func main() -> i64 |