Skip to main content

Data Loss Prevention plugin for LiteLLM: Block and mask PII in LLM requests with zero infrastructure overhead.

Project description

ceil-dlp logo

Open-Source DLP for LLMs and Agentic Workflows

Python Version License PyPI Version Build Coverage

ceil-dlp is a Data Loss Prevention (DLP) plugin for LiteLLM that automatically detects and protects Personally Identifiable Information (PII) in LLM requests. This includes PII in both text and images (pdf support is on the way). It blocks, masks, or logs sensitive data before it reaches your LLM provider. This helps prevent you from leaking your secrets, API keys, and other sensitive information. It also helps you ensure compliance with data privacy regulations like HIPAA, PCI-DSS, GDPR, and CCPA.

Usage

Install ceil-dlp:

uv pip install ceil-dlp

Then use the CLI to automatically configure LiteLLM:

ceil-dlp install path/to/config.yaml

This command will:

  1. Create a local ceil_dlp_callback.py wrapper in the same directory as your LiteLLM config
  2. Create a starter ceil-dlp.yaml configuration file
  3. Automatically update your LiteLLM config.yaml to include the callback

Then run: litellm --config config.yaml --port 4000

To customize behavior, edit the generated ceil-dlp.yaml file in the same directory as your config.

To remove ceil-dlp from your configuration:

ceil-dlp remove path/to/config.yaml

This will remove the callback from your LiteLLM config. You can also use --remove-callback-file and --remove-config-file flags to remove the generated files.

Documentation

About

ceil-dlp is an open-source solution that handles both PII + PHI (via Presidio) and secrets (API keys, tokens, credentials, etc.) in one integrated solution, eliminating the need to configure and maintain separate guardrails. ceil-dlp supports model-specific policies using pattern-based rules within a single policy definition, allowing you to configure different rules for different models directly in your configuration file. For example, you can block API keys or PII for an external model provider such as Anthropic or OpenAI while allowing them for locally hosted models. This can be done using simple regex patterns in your config, all without requiring separate guardrail definitions or per-request configuration.

ceil-dlp also provides comprehensive image support, detecting both PII and secrets in images through OCR, not just in text content. It applies automatically to all requests via LiteLLM's callback system, so you don't need to specify a guardrails parameter on every request. Finally, it supports both blocking and masking actions for all detection types, giving you full control over how sensitive data is handled.

Existing LiteLLM Guardrails

LiteLLM offers built-in guardrails for many tasks involving LLM interaction security. However, we unable to find a solution that helps with all the features a person or team working with sensitive data in a real-world LLM interaction would require.

To be more specific, LiteLLM provides two separate guardrails for data protection, each with significant limitations. LiteLLM's Presidio guardrail handles PII and PHI masking using Microsoft Presidio, but it does not handle secrets (API keys, tokens, credentials, etc.). Additionally, it only supports LiteLLM-wide configuration and cannot apply different policies to different models. It also seems to lack support for detecting PII in images, only working with text content. LiteLLM's Secret Detection guardrail is an Enterprise-only feature that requires a paid license. While it can detect secrets and can be configured per model (by defining separate guardrail configurations), it only performs redaction and cannot block requests containing secrets. It also only works on text content and does not detect or redact secrets in images.

Contributing

Contributions are always welcome! We'd love to have you contribute to ceil-dlp.

Releasing a New Version

To release a new version of ceil-dlp:

  1. Update the version in pyproject.toml:

    version = "1.2.0"
    
  2. Commit the version change:

    git add pyproject.toml
    git commit -m "Bump version to 1.2.0"
    
  3. Create and push a git tag:

    git tag -a v1.2.0 -m "Release v1.2.0"
    git push && git push --tags
    
  4. The GitHub Actions workflow will automatically build the package and publish to PyPI when the tag is pushed

The publish workflow triggers on tags matching v* (e.g., v1.2.0). Make sure your changes are committed and pushed before creating the tag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ceil_dlp-1.2.0.tar.gz (46.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ceil_dlp-1.2.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file ceil_dlp-1.2.0.tar.gz.

File metadata

  • Download URL: ceil_dlp-1.2.0.tar.gz
  • Upload date:
  • Size: 46.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ceil_dlp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e03e7e2f8771f109466701fef30f9ac959338dd415fd85fd8c53768884f4f490
MD5 a4d01c083a46609e8455f2e65908c3e0
BLAKE2b-256 1a1cda394b8fbf8188b4316b926c60058be71a6d8a8bd1d15fa7cd6f53445f07

See more details on using hashes here.

File details

Details for the file ceil_dlp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: ceil_dlp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ceil_dlp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19d4e5f0b7198a46e4a87053465ce2b8d1f2807effab1d080fe8083f47837108
MD5 76035070a3add3d868c03a3d1bb50a98
BLAKE2b-256 fcd0ccfbd29cc3c270a8b12697ae54a9db70fddbeb94bd24948d78198e818a69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page