> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beyondguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Guard: Protect Your RAG Corpus and Embeddings

> Data Guard secures the data layer of your AI stack — scanning RAG corpora, uploaded files, and embeddings for poisoned or malicious content.

The data flowing into your AI system is just as important to secure as the prompts your users submit. A model that is fed clean prompts but retrieves poisoned documents from its knowledge base will still produce harmful, manipulated, or attacker-controlled outputs. Data Guard operates at the data layer of the BeyondGuard stack, scanning retrieval databases, user-uploaded files, and embedding spaces for adversarially crafted content before it can influence your model's reasoning. Because data-layer attacks are typically persistent — a poisoned document stays in your corpus until it is removed — catching them at ingestion time is far more effective than trying to filter their effects downstream.

## What Data Guard Protects

Data Guard covers the four primary vectors through which malicious content enters your AI system's data layer.

* **RAG Corpus Integrity:** Data Guard scans your retrieval databases for poisoned or adversarially crafted documents — content designed to manipulate your model's responses when retrieved, smuggle instructions into the prompt context, or cause the model to produce specific outputs for targeted queries.
* **Uploaded File Scanning:** When users upload files that enter your AI pipeline — PDFs, spreadsheets, text files, images — Data Guard inspects them before they are indexed or passed to your model. This catches malicious instructions embedded in document content, as well as files that contain sensitive data that should not enter the corpus.
* **Embedding Integrity:** Data Guard monitors your embedding spaces for anomalous or manipulated vectors. Embedding attacks can cause retrieval systems to surface irrelevant, adversarial, or attacker-chosen documents in response to legitimate queries, effectively injecting content into the model's context without modifying any readable document.
* **Training Data Oversight:** Where your pipeline includes training or fine-tuning workflows, Data Guard flags contaminated training samples — examples crafted to introduce backdoors, bias, or targeted behaviors into a fine-tuned model.

## How Data Guard Works

Data Guard integrates with your data ingestion pipeline so that content is scanned as it enters your system, before it can influence any model queries.

<Steps>
  <Step title="Ingestion Interception">
    When a document, file, or embedding is submitted for indexing, Data Guard intercepts it at the ingestion point — before it is written to your vector store, document database, or training dataset.
  </Step>

  <Step title="Adversarial Pattern Scanning">
    Data Guard analyzes the content for adversarial patterns: embedded instruction sequences, prompt injection payloads, anomalous semantic structures, and known attack signatures. For embeddings, it evaluates vector statistics and neighborhood relationships against your corpus baseline to detect manipulated vectors.
  </Step>

  <Step title="Routing Decision">
    Clean content is approved and passed through to the retrieval pipeline or vector store as normal. Flagged content is quarantined — held in an isolated store where it can be reviewed by your team without affecting live queries — or blocked outright, depending on your operating mode and severity thresholds.
  </Step>

  <Step title="Corpus Auditing">
    In addition to scanning new content at ingestion, Data Guard can perform scheduled audits of your existing corpus to detect poisoned content that was indexed before Data Guard was enabled or before new threat signatures were deployed.
  </Step>

  <Step title="Alert and Review">
    Flagged items generate alerts in the BeyondGuard Control Plane. Your team can review quarantined content, approve it for indexing, discard it, or escalate it for deeper investigation. All decisions are recorded in the audit log.
  </Step>
</Steps>

## Configuring Data Guard

Enable and configure Data Guard from the BeyondGuard Control Plane.

<Steps>
  <Step title="Open Your Project">
    Navigate to the [Control Plane](https://app.beyondguard.io) and select the project that manages your AI data pipeline.
  </Step>

  <Step title="Open the Guards Tab">
    Inside your project, select the **Guards** tab from the left navigation panel.
  </Step>

  <Step title="Enable Data Guard">
    Locate **Data Guard** in the guard list and toggle it to **Enabled**.
  </Step>

  <Step title="Connect Your Data Sources">
    Click **Manage Data Sources** to register the data stores Data Guard should monitor. You can connect vector stores, document databases, file upload endpoints, and training data pipelines. BeyondGuard provides native connectors for major vector databases; for custom stores, use the Data Guard ingestion API.
  </Step>

  <Step title="Configure Scan Sensitivity">
    Under **Scan Settings**, set the sensitivity level for each threat category — RAG poisoning, file scanning, and embedding integrity — independently. Higher sensitivity catches more subtle attacks but may increase false positives on unusual-but-legitimate content.
  </Step>

  <Step title="Set Quarantine Behavior">
    Under **Quarantine Settings**, configure what happens to flagged content: quarantine for review, block immediately, or flag and allow (Observation Mode behavior). You can set different behaviors per threat category and per data source.
  </Step>

  <Step title="Schedule Corpus Audits">
    Under **Corpus Audit**, configure the frequency of scheduled full-corpus scans. For active corpora, a weekly audit is recommended as a baseline.
  </Step>

  <Step title="Save and Deploy">
    Click **Save Configuration**. Data Guard begins scanning all new ingestion events on this project immediately.
  </Step>
</Steps>

<Note>
  Data Guard works best when integrated at the ingestion point — scanning data as it enters your corpus rather than at query time. Query-time scanning can catch some threats, but it misses persistent poisoning that has already been indexed, introduces latency on every retrieval, and cannot quarantine malicious content before it is served to other users. Connect Data Guard to your ingestion pipeline first, then use scheduled corpus audits to catch anything that entered before integration.
</Note>

## Operating Modes

Data Guard supports two operating modes. You can switch between them at any time from the Control Plane without downtime.

|                             | **Observation Mode**                                                                                      | **Enforcement Mode**                                                                                        |
| --------------------------- | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **What it does**            | Scans all incoming content and logs detections, but never quarantines or blocks any data                  | Scans all incoming content and actively quarantines or blocks flagged items based on your configured policy |
| **Effect on data pipeline** | No impact — all content is indexed as normal regardless of detections                                     | Flagged content is quarantined for review or blocked outright; it does not enter your live corpus           |
| **Best used for**           | Auditing existing ingestion patterns, tuning sensitivity thresholds, evaluating Data Guard before go-live | Production enforcement once thresholds are tuned and your team has a quarantine review workflow in place    |
| **Audit logging**           | Full — all detections and scan results recorded                                                           | Full — all decisions (allow, quarantine, block) recorded with content metadata                              |
| **False positive risk**     | Zero pipeline impact even if misconfigured                                                                | High-sensitivity settings may quarantine legitimate but unusual content                                     |

<Tip>
  Start in Observation Mode before enforcing quarantine actions. Review the detections from a representative ingestion period to confirm that Data Guard's sensitivity levels match your corpus characteristics. Unusual-but-legitimate content — such as documents with dense technical jargon or non-standard formatting — may appear suspicious at high sensitivity settings and should be accounted for before switching to Enforcement Mode.
</Tip>
