Skip to main content

AI Security Rules

Standard Security Group rules match on fixed conditions — IP, country, headers, and so on. AI Security Rules instead route a request through an LLM, using natural-language instructions to make a judgment call that's genuinely subjective — whether a written answer is plausible, whether a submission looks like a real application, and so on.

Setup

  1. Finish installing Sentinel.
  2. Configure an AI Provider.
  3. In a Security Group, switch to Advanced view.
  4. Add a rule with action Set, field AI Prompt.
  5. Write your evaluation instruction.
[{ "action": "set", "set": [{ "field": "ai", "value": "Allow if the field..." }] }]

How it works

The AI evaluator receives the submitted fields as structured JSON — kept separate from your instruction, to resist prompt injection — and must respond with strictly true or false. Sentinel then allows or denies the request accordingly.

Writing prompts

Be explicit and closed-ended rather than open-ended:

  • "Allow only if the answer in field security_answer contains a correct answer to the security_question."
  • "Deny if countryCode is not in Europe."

Context

The prompt automatically has access to these built-in fields:

  • browser — e.g. Chrome, Firefox.
  • countryCode — ISO country code, resolved from IP/timezone.
  • devicedesktop, mobile, tablet, smartTV, wearable, or bot.
  • penalty — the request's accumulated penalty score (0–10), if any.

For anything beyond these, use Context Override to pass additional context statically or dynamically.

Use cases

  • Security questions — validate a free-text answer against the expected one.
  • Job applications — flag low-effort or clearly irrelevant submissions.
  • Event registrations — screen for plausible, on-topic responses.
  • Scholarship/grant applications — check written responses meet basic criteria.
  • High-value form submissions — add a judgment layer beyond pattern-based rules.

Usage with redirects

AI Security Rules can gate a Links and Redirects destination — add a field with a security question to the redirect page, then write a prompt evaluating the answer before allowing the redirect through.

Testing

Use the Classifier API endpoint to submit sample fields and see how your AI rule responds before enabling it in production.

Tips

  • Expect latency: evaluation against a hosted provider (e.g. ChatGPT, Gemini) can take several seconds.
  • For privacy or latency-sensitive setups, consider a self-hosted model (e.g. LLaMA via Ollama) instead of a hosted provider.

Start typing to search...

Navigate Select