nx_message_spam_detector.nx
buildroot/runtime/nx_message_spam_detector.nx
about
nx_message_spam_detector.nx -- rate-limit + chat-spam + abuse-vector audit.
module: nishi-core.perception.message_spam_detector
depends: nishi-core.perception.profile + nishi-core.perception.load_test_harness +
nishi-core.perception.perceptual_dataset + nishi-core.io.syscalls
disk_kb: 5
capability: PERCEPTION
wired_status: PARTIAL_WIRED
MISSING_CAPABILITIES:
- WS_FRAME_SPRAY (issue N WebSocket text frames per second from
M virtual users to find rate-limit threshold)
- HTTP_POST_FLOOD (REST API spam vector)
- PAYLOAD_FUZZ (oversized / malformed / unicode-bomb frame variations)
- RATE_LIMIT_DETECTION (parse 429 responses + Retry-After headers +
ban-window observation)
- PER_IP_ISOLATION_TEST (does rate-limit apply per-IP or per-session
or per-account? test all three vectors)
- SHADOW_BAN_DETECTION (some servers silently drop spam without 429;
detect by sending probe + observing peer recv of probe)
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: feedback-substrate-does-heavy-lifting-user-is-partner-not-gate_2026 +
feedback-substrate-primitives-meta-not-one-off_2026 +
feedback-racing-crew-team-honesty-threat-aware +
nx_threat_model +
owasp_2023_rate_limit_testing +
feedback-no-false-ok-substrate-honesty-audit
User directive 2026-05-20: "if it does message spam, all that bullshit."
THIS primitive measures whether the substrate's chat / WS / API
endpoints behave correctly under hostile load: rate-limited? banned?
shadow-banned? collapses? Lets through XSS / unicode-bomb?
Composes with nx_threat_model -- which ThreatActor classes does the
substrate actually defend against, measured not asserted?
Reuse set:
- nishifamily.com/video chat (PRIMARY)
- Future Nishi public APIs of any kind
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_perceptual_profile.nxnx_load_test_harness.nxnx_perceptual_dataset.nx
imported by: nobody (leaf or entry point)
structs
| 116 | struct NxSpamTestResult |
consts
| 55 | const NX_SPAM_VECTOR_RAPID_REPEAT: i64 = 1 // identical msg N times/sec |
| 56 | const NX_SPAM_VECTOR_VARIED_BURST: i64 = 2 // N unique msgs in burst |
| 57 | const NX_SPAM_VECTOR_OVERSIZED_PAYLOAD: i64 = 3 // single message > limit |
| 58 | const NX_SPAM_VECTOR_MALFORMED_UTF8: i64 = 4 // invalid encoding |
| 59 | const NX_SPAM_VECTOR_UNICODE_ZALGO: i64 = 5 // combining-char overflow |
| 60 | const NX_SPAM_VECTOR_XSS_INJECTION: i64 = 6 // <script> / event handlers |
| 61 | const NX_SPAM_VECTOR_SQL_INJECTION: i64 = 7 // SQL metachars in chat |
| 62 | const NX_SPAM_VECTOR_PATH_TRAVERSAL: i64 = 8 // ../../../etc/passwd |
| 63 | const NX_SPAM_VECTOR_BINARY_FRAME: i64 = 9 // binary on text channel |
| 64 | const NX_SPAM_VECTOR_FRAGMENTATION: i64 = 10 // many tiny WS frames |
| 65 | const NX_SPAM_VECTOR_SLOWLORIS: i64 = 11 // hold connection open, |
| 67 | const NX_SPAM_VECTOR_DUPLICATE_LOGIN: i64 = 12 // same account from N |
| 90 | const NX_SPAM_RESP_REJECTED_429: i64 = 1 // rate-limited (PROPER) |
| 91 | const NX_SPAM_RESP_REJECTED_400: i64 = 2 // bad request (PROPER for malformed) |
| 92 | const NX_SPAM_RESP_REJECTED_413: i64 = 3 // payload too large (PROPER) |
| 93 | const NX_SPAM_RESP_REJECTED_SANITIZED: i64 = 4 // accepted but content escaped |
| 94 | const NX_SPAM_RESP_ACCEPTED_PROPAGATED: i64 = 5 // PASSED to other peers (BAD if XSS etc) |
| 95 | const NX_SPAM_RESP_SHADOW_BANNED: i64 = 6 // accepted but silently dropped |
| 97 | const NX_SPAM_RESP_CONNECTION_DROPPED: i64 = 7 // server killed connection |
| 98 | const NX_SPAM_RESP_SERVER_HUNG: i64 = 8 // no response (BAD; slowloris worked) |
| 99 | const NX_SPAM_RESP_DEPENDENCY_MISSING: i64 = 9 // PARTIAL_WIRED default |
functions
| 70 | func nx_spam_vector_name(v: i64) -> *u8 |
| 101 | func nx_spam_resp_name(r: i64) -> *u8 |
| 135 | func nx_spam_test_endpoint(endpoint_url_ptr: *u8, endpoint_url_len: i64, |
| 152 | func nx_spam_test_full_audit(endpoint_url_ptr: *u8, endpoint_url_len: i64, |
| 161 | func nx_spam_test_persist_to_dataset(result_ptr: *NxSpamTestResult) -> i64 |
| 167 | func nx_spam_test_get_last_response() -> i64 |