# Security Model — Threat Analysis and Trust Boundaries > REP's security model explained. Threat analysis for XSS, CDN compromise, env var leaks, and more. Trust boundaries, encryption design, and known limitations. Source: https://rep-protocol.dev/concepts/security-model/ REP does not claim to make browser-side configuration "secure" in an absolute sense. It makes it **significantly more secure than the status quo** while making security trade-offs explicit and auditable. ## Fundamental axiom > **Anything that reaches the browser is ultimately accessible to the user and to any code running in the browser context.** REP cannot change this axiom. What it does is: 1. **Prevent accidental exposure** through classification and guardrails 2. **Raise the bar for casual extraction** through encryption of sensitive values 3. **Make intentional access auditable** through session key logging and rate limiting 4. **Eliminate unnecessary exposure** through the SERVER tier 5. **Detect tampering** through integrity verification ## Trust boundaries ``` ┌────────────────────────────────────────────────────────────────┐ │ TRUSTED ZONE │ │ │ │ Orchestrator (K8s, ECS) │ │ ↓ │ │ REP Gateway (Go binary) → Static File Server (nginx) │ │ │ │ REP_SERVER_* vars NEVER cross this boundary │ ├────────────────────────────────────────────────────────────────┤ │ TRANSIT (HTTPS/TLS) │ ├────────────────────────────────────────────────────────────────┤ │ UNTRUSTED ZONE │ │ │ │ Browser: Application Code, REP SDK, Extensions, DevTools │ │ Everything here is visible to the user │ └────────────────────────────────────────────────────────────────┘ ``` ## Threat analysis ### T1: Accidental secret exposure (HIGH) A developer prefixes a database password with `REP_PUBLIC_` instead of `REP_SERVER_`. **Mitigations:** - Naming convention forces an explicit classification decision - Guardrail scanning detects secret-like patterns in PUBLIC values - `--strict` mode makes guardrail warnings into hard failures - Manifest validation confirms variables match their declared tier **Residual risk:** Low-entropy secrets may not trigger heuristic detection. ### T2: XSS exfiltration of public variables (MEDIUM) An attacker achieves XSS and reads public config values. **Mitigations:** Largely out of scope — PUBLIC variables are by definition visible to browser code. REP helps indirectly by forcing classification (so truly sensitive values aren't in PUBLIC) and providing the SERVER tier for values that don't belong in the browser at all. ### T3: XSS exfiltration of sensitive variables (MEDIUM-HIGH) An attacker achieves XSS and attempts to read encrypted SENSITIVE values. **Mitigations:** - Values are AES-256-GCM encrypted at rest in the HTML - Decryption requires fetching a session key from `/rep/session-key` - Session keys are single-use (prevents replay) - Session keys expire in 30 seconds - Endpoint is rate-limited (10 req/min per IP) - CORS validates the requesting origin - All key issuances are audit-logged **Residual risk:** A sophisticated same-origin XSS attack could fetch a session key and decrypt values. REP raises the bar from "read the DOM" to "make an authenticated, rate-limited, logged API call." ### T4: MITM payload tampering (HIGH) An attacker modifies the injected `