Skip to main content
The Document Analyzer plugin scans uploaded files (PDF, DOCX, images, etc.) for Personally Identifiable Information (PII), jailbreak attempts, and other sensitive content before they are processed by your AI application.

Features

  • Multi-format support: PDF, DOCX, XLSX, PPTX, images (PNG, JPEG, TIFF)
  • PII detection: Email, credit cards, phone numbers, national IDs, and more
  • Jailbreak detection: Detect prompt injection and jailbreak attempts in document content
  • OCR support: Extract text from images and scanned documents
  • Configurable blocking: Choose which PII entities trigger blocking and set jailbreak thresholds

Configuration

{
  "name": "doc_analyzer",
  "enabled": true,
  "stage": "pre_request",
  "settings": {
    "mode": "enforce",
    "max_file_size": 52428800,
    "pii": {
      "entities": [
        "email",
        "credit_card",
        "iban",
        "phone_number",
        "spanish_dni",
        "spanish_nie"
      ]
    },
    "firewall": {
      "enabled": true,
      "threshold": 0.7,
      "credentials": {
        "base_url": "https://api.neuraltrust.ai",
        "token": "your-api-token"
      }
    },
    "ocr": {
      "enabled": true,
      "languages": ["en", "es"]
    }
  }
}

Settings

ParameterTypeDescriptionDefault
modestringenforce (block) or observe (log only)enforce
max_file_sizeintegerMaximum file size in bytes52428800 (50MB)

PII Configuration

ParameterTypeDescriptionDefault
pii.entitiesarrayList of PII entity types to detect and block[]

Firewall Configuration (Jailbreak Detection)

ParameterTypeDescriptionDefault
firewall.enabledbooleanEnable jailbreak detectionfalse
firewall.thresholdfloatJailbreak score threshold (0.0-1.0)0.7
firewall.credentials.base_urlstringNeuralTrust API base URL-
firewall.credentials.tokenstringNeuralTrust API token-

OCR Configuration

ParameterTypeDescriptionDefault
ocr.enabledbooleanEnable OCR for imagesfalse
ocr.languagesarrayOCR language codes["en"]

Supported PII Entities

EntityDescription
emailEmail addresses
credit_cardCredit card numbers
ibanInternational Bank Account Numbers
phone_numberPhone numbers
spanish_dniSpanish National ID
spanish_nieSpanish Foreigner ID
ssnSocial Security Numbers
passportPassport numbers

Modes

Enforce Mode

When mode is set to enforce, the plugin will:
  • Block requests containing files with detected PII (if PII entities are configured)
  • Block requests with jailbreak scores above the threshold (if firewall is enabled)
  • Return a 403 Forbidden response with details about detected threats

Observe Mode

When mode is set to observe, the plugin will:
  • Log detected PII and jailbreak attempts without blocking the request
  • Allow the request to proceed
  • Record findings in observability data

Example Responses

PII Detected (Blocked)

{
  "error": "PII detected in document",
  "status": 403,
  "details": {
    "mode": "enforce",
    "action": "blocked",
    "pii_detected": true,
    "pii_entities": [
      {
        "type": "email",
        "value": "[email protected]",
        "file": "document.pdf"
      }
    ]
  }
}

Jailbreak Detected (Blocked)

{
  "error": "Jailbreak attempt detected in document",
  "status": 403,
  "details": {
    "mode": "enforce",
    "action": "blocked",
    "jailbreak_detected": true,
    "jailbreak_score": 0.92,
    "threshold": 0.7
  }
}

Combined Detection (Blocked)

{
  "error": "Security threats detected in document",
  "status": 403,
  "details": {
    "mode": "enforce",
    "action": "blocked",
    "pii_detected": true,
    "pii_entities": [
      {
        "type": "credit_card",
        "value": "4111-XXXX-XXXX-1111",
        "file": "invoice.pdf"
      }
    ],
    "jailbreak_detected": true,
    "jailbreak_score": 0.85,
    "threshold": 0.7
  }
}

Use Cases

  1. Data Loss Prevention: Prevent sensitive data from being sent to AI models
  2. Jailbreak Protection: Block prompt injection attempts hidden in documents
  3. Compliance: Ensure GDPR, CCPA, and other regulatory compliance
  4. Audit Trail: Log all PII and jailbreak detection events for security audits
  5. Multi-layer Security: Combine PII and jailbreak detection for comprehensive protection