Skip to main content

Scan historical LLM traces for credential leaks and prompt-injection evidence

Project description

canari-forensics

PyPI package CI License: MIT

Scan your LLM logs for breaches that already happened.

LLM applications can leak internal context through prompt injection attacks. Your firewall never flags it because the exfiltration looks exactly like a legitimate API response. Most teams find out weeks later - if ever.

Canari Forensics scans your existing LLM conversation logs and tells you definitively whether you have had any successful prompt injection or credential leakage before you were monitoring. Exact pattern matching, no classifiers, no false positives. Runs locally in under a minute. No data leaves your environment.

Demo

Run the local demo to see Canari Forensics find incidents in sample logs:

./scripts/demo_local_audit.sh

Canari demo

MLflow / OTEL Integration

If you are using MLflow to trace your LLM applications, export your traces and point Canari Forensics at the output:

# Export traces from MLflow
mlflow traces export \
  --experiment-id YOUR_EXPERIMENT_ID \
  --output-dir ./traces/

# Scan with Canari Forensics
canari forensics scan \
  --source otel \
  --provider generic \
  --logs ./traces/ \
  --out ./forensics-scan.json

Compatible with local MLflow and any platform that exports OTEL traces.

Install

pip install canari-forensics

If your environment blocks package installs, you can run directly with python3 -m canari_forensics .... After install, run canari ... directly.

Quick start

# 1) Scan OTEL JSON exports (generic/datadog/honeycomb via --provider)
canari forensics scan \
  --source otel \
  --provider generic \
  --logs ./otel-traces \
  --file-pattern '*.json' \
  --out ./forensics-scan.json

# 2) Generate enterprise audit outputs
canari forensics report \
  --scan-report ./forensics-scan.json \
  --client "Acme Corp" \
  --application "AI Gateway" \
  --out-pdf ./audit-report.pdf \
  --out-evidence ./canari-evidence.json \
  --bp-dir ./tests/attacks

Staged audit workflow

# initialize audit workspace
canari forensics audit init \
  --name "Q1 2026 AI Gateway Audit" \
  --source otel \
  --provider generic \
  --logs ./otel-traces \
  --client "Acme Corp" \
  --application "AI Gateway"

# run scan and report using stored metadata
canari forensics audit scan --audit-id q1-2026-ai-gateway-audit
canari forensics audit report --audit-id q1-2026-ai-gateway-audit

One-command audit from config

cp .canari.yml.example .canari.yml
canari forensics audit run --config .canari.yml

Custom pattern packs

canari forensics report \
  --scan-report ./forensics-scan.json \
  --client "Acme Corp" \
  --application "AI Gateway" \
  --out-pdf ./audit-report.pdf \
  --out-evidence ./canari-evidence.json \
  --bp-dir ./tests/attacks \
  --patterns-file ./custom_patterns.json

The JSON file should contain either {"patterns": [...]} or a top-level array, where each pattern has: pattern_id, name, severity, confidence, kind, regex.

Local demo checkpoint

./scripts/demo_local_audit.sh

Real-time OTLP receiver

canari forensics receive \
  --host 0.0.0.0 \
  --port 4318 \
  --db ./canari-forensics.db

Outputs:

  • Scan JSON with normalized conversation turns
  • Evidence JSON with findings and metadata
  • PDF audit report for executive review
  • .bp.json snapshots for BreakPoint CI workflows

Related Tools

Maintainer

Maintained by Christopher Holmes Silva.

Feedback is welcome from developers shipping LLM applications.

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

canari_forensics-0.1.5.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

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

canari_forensics-0.1.5-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file canari_forensics-0.1.5.tar.gz.

File metadata

  • Download URL: canari_forensics-0.1.5.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for canari_forensics-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4902e9a7230fef47b3698f81c8183ed7226665588316a1640cafd40520cdc08d
MD5 2a39fb2ab7db0df3d09b46471386d0d3
BLAKE2b-256 e240ae2e8ea3170a81f1e933bd21f4ad3ad5b958282d7efd4e56298145073fc2

See more details on using hashes here.

File details

Details for the file canari_forensics-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for canari_forensics-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 abdf72dc5b4901b135b2fb5bbd8dc2783f043d42213a7737104bd7472d9706b6
MD5 f83ff64b4019523f324c0e44fb993677
BLAKE2b-256 56efdc695944adcfacffc13924c5fa35a1235bb21fec636c0dabeb1e4b55608f

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