For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

  1. Navigate to Policy → Assets → GenAI.

  2. Open Custom GenAI Security Rules and Exceptions.

  3. Click to add a new rule.

  4. Configure the conditions and action.

  5. Click OK and Enforce.

Prevention Behavior

When a request or response is blocked by GenAI Security:

  • Blocked request — returns a 403 status code with an HTML page indicating "traffic was blocked by WAF". Custom prevention page support will be added soon.

  • Blocked response — returns a 200 OK with 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:

Setting
Description

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

  1. Start in Learn/Detect mode — allow the ML engine to train on your application's traffic patterns before switching to Prevent mode.

  2. Monitor logs before preventing — review detected events in Learn/Detect mode to understand your traffic patterns and tune sensitivity thresholds before switching to Prevent.

  3. Set appropriate confidence thresholds — start with Medium or Above for a balanced approach. Adjust based on observed false positive rates.

  4. 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 -

GenAI Security Learning

Last updated

Was this helpful?