GenAI Security
Overview
Generative AI (or GenAI) is transforming applications by enabling natural interactions, automation, and advanced decision-making. However, these capabilities also introduce new security risks such as prompt injection, data leakage, sensitive content exposure, and misuse of resources. Traditional security controls are not designed to handle these challenges.
CloudGuard WAF addresses this with an Ensemble learning model purpose-built for GenAI applications.
CloudGuard WAF combines:
Engine 1 – Prompt & Data Classification A super-fast supervised model trained on millions of prompts and attacks classifies inputs in real time.
Engine 2 – Contextual & Semantic Analysis This semantic engine ensures accurate decisions on whether to approve or block requests.
This Ensemble approach delivers:
Best-in-class detection accuracy
Continuous adaptation to new threats
Minimal latency (as low as 50ms, depending on prompt size)
Configuration
Settings
GenAI Security settings can be configured during the asset creation, see instructions here. Or from the asset directly:
Step 1: Edit the web API/application asset through Policy->Assets-> General Tab.

Configure the following:
Request URI: Enter the API endpoint for LLM prompts (e.g., /api/chat).
Prompt Location: Specify where the prompt appears in the request body (e.g., body.prompt).

Under Advanced you can configure the following:
Expected Prompts: Choose One:
Wide range – many different prompt types.
Specific – narrow, domain-focused prompts.
Expected Users:
All users (internal & external)
Internal roles (e.g., admin, sales)
External roles (e.g., customers, partners)
One specific role
Application Description: Add a short note on your app’s purpose to improve protection accuracy.
Modes
All GenAI Security Modes can be configured by navigating to Policy → Assets and editing the GenAI tab in the Web Application Asset.

GenAI Security protects AI-driven applications using multiple protection models:
Learn / Detect – monitors activity, detects suspicious behavior, and learns usage patterns.
Prevent – actively blocks malicious or risky inputs/outputs when detected.
Disabled - not activating the protection.
Protection Types
Prompt Injection PreventionData Leakage PreventionContent ControlUsage Guard (Coming Soon)Custom Rules and Exceptions
Custom Rules and Exceptions allow security administrators to fine-tune behavior when specific traffic should be handled differently — for example, to prevent false positives or adjust enforcement for known traffic patterns.

To add a custom rule or exception:
Navigate to Policy → Assets → GenAI.
Open Custom GenAI Security Rules and Exceptions.
Click to add a new rule.
Configure the conditions and action.
Click OK and Enforce.
Custom Rules and Exceptions take effect only when GenAI Security is active, when at least one GenAI practice is set to a mode other than Disabled (Learn/Detect or Prevent). If all GenAI practices are Disabled, traffic is not inspected and these rules have no effect.
Prevention Behavior
When a request or response is blocked by GenAI Security:
Blocked request — returns a
403status code with an HTML page indicating "traffic was blocked by WAF". Custom prevention page support will be added soon.Blocked response — returns a
200 OKwith network cutoff (the response body is not delivered to the client).
Data Retention
All data used for learning is anonymized (PII is stripped) and is used only in the context of that tenant.
Logging
Malicious traffic is always logged regardless of these settings. The prompt logging configuration below controls logging of benign (non-malicious) prompts and responses only.
To control what is logged, edit the Log Trigger settings:
Prompt Logging Direction
Choose to log benign Input, Output, or Input and Output.
Note: Input logging captures prompts sent to the LLM. Output logging captures LLM responses. You can enable either or both independently.
Best Practices
Start in Learn/Detect mode — allow the ML engine to train on your application's traffic patterns before switching to Prevent mode.
Monitor logs before preventing — review detected events in Learn/Detect mode to understand your traffic patterns and tune sensitivity thresholds before switching to Prevent.
Set appropriate confidence thresholds — start with
Medium or Abovefor a balanced approach. Adjust based on observed false positive rates.Give the system time to improve — GenAI Security learns from its own detection errors and refines its models continuously. The longer the system observes your traffic, the more accurate it becomes - you can read more about GenAI Secuirty Learning here -
Last updated
Was this helpful?