Skip to main content
AI Security·Updated 2026-10-21

How do I secure an AI chatbot on my website?

Short answer

Give the chatbot access only to the data and actions it truly needs, keep secrets out of the system prompt, filter and validate its output before it reaches other systems, rate-limit usage, log conversations for abuse review, and require human approval for anything that changes data or spends money.

The details

Assume users will try to make the bot ignore its instructions. Test it with prompt injection and data leakage scenarios before launch, and review the OWASP Top 10 for LLM Applications for the risks to cover.

What to do

  • Restrict data sources and tool permissions.
  • Keep API keys and secrets out of prompts.
  • Validate and encode model output.
  • Rate-limit and monitor usage.
  • Test with injection attempts before launch.

Terms explained

Least privilege
Least privilege means giving each user, service or AI agent only the access it needs to do its job, and no more, for only as long as it needs it.
Prompt injection
Prompt injection is an attack on AI applications in which crafted input, typed directly or hidden in content the model reads, overrides the developer’s instructions.
OWASP Top 10
The OWASP Top 10 is an awareness list of the most critical security risks to web applications, published by the Open Worldwide Application Security Project.

Sources

Related questions