the threat model transforms when migrating from a solo developer on localhost to multi-tenant public web applications. protect your infrastructure, your customers, and your cloud balance sheet.
1. micro-vm isolation over containers
shared containers are not a security boundary
intuition: staying in adjacent hotel rooms with thin drywall versus staying in freestanding concrete houses on separate parcels of land.
architecture: in a public or enterprise SaaS where agents execute user-supplied code or untrusted workloads, standard Docker containers share the host Linux kernel. A single kernel vulnerability (privilege escalation, dirty COW, eBPF bugs) allows container escapes and host takeover. Deploy hardware-virtualized micro-VMs: AWS Firecracker, Fly.io Machines, or gVisor (runsc). Each tenant's agent execution runs in a distinct virtual machine with its own isolated kernel.
2. multi-tenant vector store & memory isolation
prevent cross-tenant data exfiltration through retrieval
intuition: two people using the same filing cabinet, but each drawer has an independent mechanical lock that the other key cannot turn.
architecture: in RAG pipelines and long-term agent memory, never rely on soft application-level prompt filters to separate tenant records. Enforce database Row-Level Security (RLS) in PostgreSQL/pgvector or cryptographically distinct namespaces in vector databases (Qdrant, Pinecone). If Tenant A suffers an indirect prompt injection, the database itself mathematically rejects queries attempting to retrieve Tenant B's embeddings.
3. denial of wallet & circuit breakers
bound compute resources, tokens, and billing loops
intuition: an emergency shut-off valve on the main water pipe that automatically trips if flow exceeds safe limits for more than thirty seconds.
architecture: mitigate OWASP LLM04 by enforcing hard operational ceilings: (a) sliding-window token rate limiters per organization and user, (b) strict tool execution step ceilings (e.g. hard termination after 15 tool calls), (c) request timeouts (e.g. 60-second execution deadlines), and (d) cloud billing threshold webhooks that automatically downgrade frontier model access to local fallbacks upon budget exhaustion.
4. zero-trust egress & cloud metadata protection
neutralize ssrf and credential harvesting
intuition: an office mailroom that inspects every outgoing parcel, confiscating letters addressed to internal maintenance rooms or private safes.
architecture: cloud-hosted agent tools capable of making HTTP requests are prime targets for SSRF. Egress firewalls must drop all traffic to cloud metadata addresses (169.254.169.254 on AWS, GCP, and Azure) to prevent IAM credential theft. Block all RFC 1918 private subnets (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and route outbound internet traffic through forward proxies enforcing strict domain allowlists.
5. pii masking & enterprise secret management
keep customer data and api credentials off third-party logs
intuition: blacking out social security numbers and account numbers on legal documents with permanent marker before mailing them to external reviewers.
architecture: deploy enterprise secret managers (HashiCorp Vault, AWS Secrets Manager, Infisical) to issue short-lived, dynamic credentials with automated rotation. Never store plaintext tokens in environment files on shared hosts. Deploy automated PII redaction (Microsoft Presidio) at the API gateway, masking names, credit cards, and emails before payloads reach upstream frontier LLMs.
6. immutable cryptographic audit logging
tamper-evident forensic ledgers for enterprise compliance
intuition: a flight recorder sealed inside an armored black box that records every pilot action, instrument readout, and rudder angle.
architecture: required for SOC 2, ISO 27001, and HIPAA compliance: record an append-only, tamper-evident audit ledger capturing every user prompt, retrieved RAG context document, model reasoning step, exact tool invocation parameters, and execution output. Store audit records in WORM (Write Once, Read Many) cloud object storage (e.g. AWS S3 with Object Lock) for incident response and forensic analysis.