Adding an LLM to your app opens a new attack surface. Seven risks to handle before production.
The risks
- Prompt injection — separate instructions from data with XML tags.
- Data leakage — no cross-tenant mixing.
- Tool use abuse — least privilege, human confirmation for destructive actions.
- Runaway cost — strict max_tokens, rate limits.
- Jailbreaks — output guardrails, adversarial tests.
- Hallucinations — grounding via RAG, disclaimers.
- Exposed API key — always proxy server-side.