Skip to main content

ASGI middleware for runtime PII leak detection — FastAPI/Starlette host for the wiregraph detection core

Project description

wiregraph-fastapi

ASGI middleware for runtime PII leak detection in FastAPI/Starlette apps. Reuses the framework-agnostic detection core from wiregraph — no Django at runtime.

Status

0.1.0 — log-only release. Detections are emitted to a configurable logger. Storage (SQLAlchemySink, alembic migrations) and a DRF-compatible read API land in 0.2.0 / 0.3.0.

Install

pip install wiregraph-fastapi

Quick start

from fastapi import FastAPI
from wiregraph_fastapi import LoggingSink, WiregraphMiddleware

app = FastAPI()
app.add_middleware(WiregraphMiddleware, sink=LoggingSink())

POST a request with PII in the body and a structured log line is emitted per match.

What's covered in 0.1.0

  • Ingress: scans request bodies for PII before your handler sees them.
  • Egress: scans response bodies after your handler returns (non-streaming only).
  • JSON path enrichment: matches in JSON bodies are annotated with their dotted path.
  • Admin-path exclusion: configurable URL prefixes are skipped.
  • Tenant resolution: single-tenant by default; bring your own resolver for multi-tenant.

What's not covered in 0.1.0

  • Streaming responses (StreamingResponse) — skipped, logged at debug.
  • Websocket frames.
  • Outbound HTTP interception (planned post-v1).
  • Presidio async pass (regex-only).
  • Persistent storage and dashboard — coming in 0.2.0 / 0.3.0.

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

wiregraph_fastapi-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

wiregraph_fastapi-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file wiregraph_fastapi-0.1.0.tar.gz.

File metadata

  • Download URL: wiregraph_fastapi-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for wiregraph_fastapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 013eff87a349c239717829bc4e15ae5a1e6476e8f452433d6dd9082a0e1c659e
MD5 daaabfd529590786429519637b0c48ba
BLAKE2b-256 ee1b8cb476ccd845065b4de5387e9c45d0c15db133abad65405d0d695055bd8c

See more details on using hashes here.

File details

Details for the file wiregraph_fastapi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wiregraph_fastapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 872be49c6a98134276489888fbb2821869b332861987fb3bc8b0fb8d577ea5c1
MD5 dad5738fe76164527b8027cf4a4f9525
BLAKE2b-256 44fcd2978a2759fefccdfa32441c549d6923fc19670bc1158baff8584309b243

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