> For the complete documentation index, see [llms.txt](https://waf-doc.inext.checkpoint.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://waf-doc.inext.checkpoint.com/additional-security-engines/genai-security.md).

# 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.&#x20;
* **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](/getting-started/protect-a-web-application-api.md#step-4-genai-protection). Or from the asset directly:

**Step 1:** Edit the web API/application asset through Policy->Assets-> General Tab.

<figure><img src="https://2760087783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEWA4nfgNrSRL8dA6Kap7%2Fuploads%2FsvUr0hDx3ddpDimYnei6%2Fimage.png?alt=media&amp;token=26b2fbb8-c2af-4495-9825-e5ae067c9b0e" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2760087783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEWA4nfgNrSRL8dA6Kap7%2Fuploads%2FsNCeBWrUp2j8Ep3tnlBN%2Fimage.png?alt=media&amp;token=065f2c19-ac7e-4b36-9761-359e220704ad" alt="" width="375"><figcaption></figcaption></figure>

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.

<figure><img src="https://2760087783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEWA4nfgNrSRL8dA6Kap7%2Fuploads%2FgO7SAX3jlTwNti9v7Txq%2Fimage.png?alt=media&amp;token=1b233dec-756e-4c03-aad9-5219015c38dd" alt=""><figcaption></figcaption></figure>

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

{% content-ref url="/pages/0fINY3gNKybZDg0AX6jW" %}
[Prompt Injection Prevention](/additional-security-engines/genai-security/prompt-injection-prevention.md)
{% endcontent-ref %}

{% content-ref url="/pages/VgWiKc6bzmARyw1BS7cx" %}
[Data Leakage Prevention](/additional-security-engines/genai-security/data-leakage-prevention.md)
{% endcontent-ref %}

{% content-ref url="/pages/eEksU3fyqIPIzkFSYn91" %}
[Content Control](/additional-security-engines/genai-security/content-control.md)
{% endcontent-ref %}

{% content-ref url="/pages/IooEOa1CTViQtSrZlS1Q" %}
[Usage Guard (Coming Soon)](/additional-security-engines/genai-security/usage-guard-coming-soon.md)
{% endcontent-ref %}

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

<figure><img src="https://2760087783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEWA4nfgNrSRL8dA6Kap7%2Fuploads%2FqADuvFp0YiLVB5HkHCIc%2Fimage.png?alt=media&amp;token=bcdde67c-566b-497d-b609-9972b5c55fc2" alt=""><figcaption></figcaption></figure>

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

{% hint style="warning" %}
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.
{% endhint %}

### 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 -&#x20;

{% content-ref url="/pages/uw8hPSYsHX4jSrt0z76O" %}
[GenAI Security Learning](/additional-security-engines/genai-security/genai-security-learning.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://waf-doc.inext.checkpoint.com/additional-security-engines/genai-security.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
