code wiki / _hdl_build / nx_meet_intake_process.nx

nx_meet_intake_process.nx source

↩ module page · 28 lines · 1751 B

1// nx_meet_intake_process.nx -- P2 (logic): the sovereign SUBMISSION PROCESSOR (LIBRARY, no main) -- the brain a 2// live POST handler will call. Composes R7 curation (auto-screen: bot/AI-slop/ghost -> FLAGGED) with control-char 3// sanitation so an untrusted form submission becomes (a) a verdict, (b) a CRLF/header-injection-safe application 4// record, (c) an injection-safe confirmation message. The last-mile socket route is a thin wrapper (operator 5// infra); durable seg-store persistence is the P4 follow-on. license_tier: ORIGINAL 6import "nx_syscalls.nx" 7import "nx_meet_lib.nx" 8import "nx_meet_curate.nx" 9 10// append "key: <sanitized value>\n" -> new off. DATA values are stripped of control chars (meet_san) so they can 11// NEVER inject a record line or an email header. 12func rec_field(out: *u8, off: i64, key: *u8, val: *u8) -> i64 { 13 var o: i64 = mcat(out, off, key); o = mcat(out, o, ": " as *u8) 14 o = meet_san(out, o, val) 15 out[o] = 10 as u8; o = o + 1; out[o] = 0 as u8 16 return o 17} 18 19// build an RFC-5322-ish confirmation into out. The organ supplies the CRLF structure; every UNTRUSTED field 20// (To/Subject/name) is meet_san'd -> a submitted "\r\nBcc: evil" collapses into inert text, never a new header. 21func intake_confirm(out: *u8, name: *u8, email: *u8, subj: *u8) -> i64 { 22 var o: i64 = mcat(out, 0, "From: intake@community-meet.example\r\nTo: " as *u8) 23 o = meet_san(out, o, email) 24 o = mcat(out, o, "\r\nSubject: " as *u8); o = meet_san(out, o, subj) 25 o = mcat(out, o, "\r\n\r\nHi " as *u8); o = meet_san(out, o, name) 26 o = mcat(out, o, ",\r\n\r\nThanks -- we received your request. Every member is verified before you meet anyone; we will be in touch.\r\n\r\n-- Community Meet\r\n" as *u8) 27 return o 28}