Architecture & Security Hardening
ModelPrism enforces zero-trust privacy and 100% browser-side statistical execution: the optional Cloudflare Worker serves purely as an in-memory CORS-free relay.
1. Zero-Persistence Client Architecture
- Browser-Local Scoring: The 203-model reference library (
/data/reference-library.json), prompt battery (/data/prompts.json), calibrated thresholds (/data/thresholds.json), RGB100 distance metrics, 999-permutation tests, and 3D point-cloud renderer run strictly inside the browser. - Ephemeral Keys: API keys live only in React tab memory and vanish on tab close. Custom baselines store color distributions only in
localStorage(hueprint-public-baselines-v1). - Zero-Logging Worker (
wrangler.jsonc): Deployed withobservability.enabled = falseand zero KV/D1/R2 bindings.
2. Edge Relay Security Controls (worker/)
| Layer | File | Hardening Behavior |
|---|---|---|
| SSRF Protection | worker/probeHandler.ts | Blocks loopback, RFC1918 private networks, CGNAT (100.64.0.0/10), cloud metadata (169.254.169.254, 100.100.100.200, fd00:ec2::254, metadata.google.internal), IPv6 ULA/link-local/NAT64, obfuscated IPs, internal TLDs, and database/cache ports |
| Manual Hop-by-Hop Redirects | worker/probeHandler.ts | Follows up to 3 hops via redirect: "manual", re-validating SSRF rules per hop and stripping credentials/custom headers across host or scheme changes |
| Cross-Origin Guards | worker/probeHandler.ts | Enforces Fetch Metadata (Sec-Fetch-Site rejects cross-site and same-site) and strict tuple-origin equality (Origin, rejecting "null") |
| Edge Rate Limiting | wrangler.jsonc | PROBE_RATE_LIMITER allows 240 requests / 60s per client IP with an in-isolate fallback limiter |
| Payload, CSP & Redaction | worker/index.ts | 64 KiB max request body, 512 KiB max upstream body, 45s timeout, strict header allowlist (never forwarding browser Cookie), strict CSP, and secret scrubbing on all errors |
| Plain HTTP Sockets | worker/socketHttp.ts | Uses cloudflare:sockets for public HTTP domains, raw IPs, and custom ports |