Open source agent security suite — intercept, scan, and test your AI agents
Project description
dscan
An open source agent security suite. Trace and redact your agent's tool calls, scan its prompts and MCP configs, and detect suspicious call chains — then inspect everything in a local dashboard.
pip install dscan-security
The package installs as dscan-security; the import path and CLI stay
dscan (import dscan, dscan --help).
Quick start
from dscan import watch
@watch
async def my_agent(task: str):
... # your agent code, unchanged
Run your agent, then open the dashboard:
dscan dashboard
Tool calls are written as redacted NDJSON to ~/.dscan/traces/ (override
with DSCAN_TRACES_DIR). Wrapping any tool with @watch.tool traces its
params and result; if you use the Anthropic SDK, @watch also intercepts
messages.create() and traces each tool_use block.
What dscan catches
| Capability | What it detects |
|---|---|
@watch (tracing) |
Every tool call — name, params, result, duration — written as redacted NDJSON; flags calls whose params contain secrets |
| Redaction | AWS keys, Anthropic/OpenAI/GitHub/Stripe tokens, JWTs, emails, phone numbers, SSNs, Luhn-valid credit cards, database-URL passwords, high-entropy secrets |
dscan scan |
Permissive prompts, injection-prone prompts, hardcoded secrets, excessive tool scope; unverified, overprivileged, and credential-leaking MCP servers |
dscan trail |
Suspicious tool-call sequences across an agent run (exfiltration, recon, injection relay, data staging, goal drift) |
dscan dashboard |
Local web UI: sessions, per-call timeline, redacted values, secrets flags, and trail findings |
Commands
dscan scan
Static analysis of system prompts and MCP config files in a directory.
Exits 1 if any high-severity issue is found.
$ dscan scan ./prompts
HIGH (1)
┏━━━━━━━┳━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Rule ┃ File ┃ Line ┃ Message ┃ Snippet ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ SP003 │ sp.txt │ 2 │ Hardcoded secret in prompt │ ...sk-ant-api03... │
└───────┴────────┴──────┴─────────────────────────────┴───────────────────┘
✗ 1 high-severity finding(s).
dscan watch
@watch is a decorator, not a runtime command. This prints a reminder:
$ dscan watch
⚠ Add @watch to your agent function. See README for usage.
dscan trail
Reads trace files and reports suspicious tool-call chains, grouped by
severity. Exits 1 on any high or critical finding. Supports
--min-severity {low|medium|high|critical} and --json.
$ dscan trail ~/.dscan/traces/
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Severity ┃ Pattern ┃ Tools Involved ┃ Message ┃ Confidence ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ CRITICAL │ INJECTION_RELAY │ search_web → send_email │ untrusted... │ 85% │
│ HIGH │ EXFIL_SEQUENCE │ read_file → send_email │ read then... │ 80% │
└──────────┴─────────────────┴─────────────────────────┴───────────────┴────────────┘
2 findings across 5 tool calls analysed
dscan dashboard
Serves the local web UI at localhost:4321. --port sets the port;
--no-open skips opening a browser.
$ dscan dashboard --no-open
✓ Dashboard at http://127.0.0.1:4321 (Ctrl-C to stop)
How trail works
dscan trail reads your trace files and looks at the order of tool
calls, not just each call on its own. It groups calls by agent run and
reports five kinds of suspicious sequences: reading sensitive data and
then sending it somewhere external (exfiltration), probing for
permissions and then running a tool the agent never declared
(reconnaissance), pulling in untrusted web or email content and then
immediately sending or executing (injection relay), reading several
different sensitive sources in a row with nothing sent in between (data
staging), and taking destructive or outbound actions that a read-only
goal never asked for (goal drift). Each finding carries a severity and a
confidence score so you can triage.
Contributing
git clone https://github.com/DeepScan-Security/dscan
cd dscan
pip install -e ".[dev]"
pytest
Built test-first; coverage stays at or above 80%. See CONTRIBUTING.md for what we need help with, and SECURITY.md to report a vulnerability.
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dscan_security-0.1.0.tar.gz.
File metadata
- Download URL: dscan_security-0.1.0.tar.gz
- Upload date:
- Size: 72.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65d64663bf4fcd7a838afdb76cb13021629c1b3d19187757ce341154f29dd2f6
|
|
| MD5 |
54498020a15fbf1c1b2343afb726a135
|
|
| BLAKE2b-256 |
19dcc2fb14eec5f9e290d4a1c0fd2831b2eaf6cd31f67f6d7c1b10007b80fea2
|
File details
Details for the file dscan_security-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dscan_security-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2b893d4248bdea8ed82d6eccec3e10344003be668a333dbd012c4ac48d59f0e
|
|
| MD5 |
291092489cf978b0782b1a471d9183be
|
|
| BLAKE2b-256 |
a8ffaa0f84cc600aee7d54ea1e405d58c338aae6459d24ddb26a4c194e328974
|