How borik216/prompt-shield works
PromptShield is a TLS-intercepting proxy that detects hosted LLM traffic, checks outgoing prompts for sensitive data, reconstructs provider-specific streamed replies, and records conversation turns for a live dashboard. The main workflow runs through the detector addon: classify and extract a request, scan it with DLP, block locally when needed, then capture the response and append a detection record. Separate capabilities include provider-format research via the recorder and proxy/certificate onboarding via the CLI. Relationships for unsampled modules are included only where the README documents them; optional integrations are marked dashed.
Main entry points: addon.py Detector addon · cli.py PromptShield CLI · engine.py DLP rule engine · main.py Dashboard HTTP UI
Components 18
Proxy detection
- Detector addon
detector/addon.py - Provider rules
detector/config.py - Request extraction
detector/extract.py - Stream reconstruction
detector/sse.py - Overlay response helpers
detector/overlay.py - Browser overlay
detector/static/promptshield_overlay.js
DLP and blocking
- DLP rule engine
dlp/engine.py - Presidio PII backend
dlp/presidio_backend.py - Local LLM backend
dlp/local_llm_backend.py - Block response builder
dlp/blocked_page.py
Records and dashboard
- Detection NDJSON
- Dashboard HTTP UI
dashboard/main.py - Record views and stats
dashboard/data.py
Operations and capture
- PromptShield CLI
cli.py - Raw traffic recorder
recorder/addon.py - Platform and CA helpers
detector/platform_utils.py
Other components
- Browser user
- Hosted LLMs
Connections 20
- Browser user → Detector addon: sends traffic
README.md - Detector addon → Hosted LLMs: forwards requests
README.md - Detector addon → Provider rules: classifies flows
detector/addon.py - Detector addon → Request extraction: extracts prompts
detector/addon.py - Detector addon → DLP rule engine: scans prompts
detector/addon.py - Detector addon → Stream reconstruction: reconstructs replies
detector/addon.py - Detector addon → Block response builder: renders fallback
detector/addon.py - Detector addon → Overlay response helpers: builds block response
detector/addon.py - Detector addon → Browser overlay: injects script
- Browser overlay → Browser user: shows block notice
README.md - DLP rule engine → Presidio PII backend: checks PII
dlp/engine.py - DLP rule engine → Local LLM backend: optional backend
- Detector addon → Detection NDJSON: appends records
README.md - Dashboard HTTP UI → Record views and stats: requests views
dashboard/main.py - Record views and stats → Detection NDJSON: reads records
README.md - PromptShield CLI → Detector addon: starts proxy
README.md - PromptShield CLI → Raw traffic recorder: starts capture
README.md - PromptShield CLI → Dashboard HTTP UI: starts dashboard
README.md - PromptShield CLI → Platform and CA helpers: installs CA
cli.py - Browser user → Dashboard HTTP UI: views activity
README.md