Skip to content

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 with observability.enabled = false and zero KV/D1/R2 bindings.

2. Edge Relay Security Controls (worker/) ​

LayerFileHardening Behavior
SSRF Protectionworker/probeHandler.tsBlocks 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 Redirectsworker/probeHandler.tsFollows 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 Guardsworker/probeHandler.tsEnforces Fetch Metadata (Sec-Fetch-Site rejects cross-site and same-site) and strict tuple-origin equality (Origin, rejecting "null")
Edge Rate Limitingwrangler.jsoncPROBE_RATE_LIMITER allows 240 requests / 60s per client IP with an in-isolate fallback limiter
Payload, CSP & Redactionworker/index.ts64 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 Socketsworker/socketHttp.tsUses cloudflare:sockets for public HTTP domains, raw IPs, and custom ports