Pre-runtime scanning
Catch hardcoded secrets before the agent ever runs.
Static code scan reads an agent's own source — a local directory, an uploaded zip, or a GitHub repo — for hardcoded secrets, PII in log statements and sensitive values sent to third parties, before a single trace is captured.
Three ways to submit code
Point the scanner at a local directory, a zip file, or a GitHub repo and branch — it reads the same source your agent runs, not a sandboxed copy.
- `agentleak scan <path>` for a local directory or .zip
- `agentleak scan --repo owner/name --branch main`
- POST /api/agent/code for an agent scanning itself
- Detector settings honour your project's agentleak.yaml
The same severity model
Findings use the identical L1 to L4 severity scale as trace analysis, plus code-specific layers, so a hardcoded API key and a leaked account_id are directly comparable.
- L1 to L4 severity per finding
- Entropy analysis for high-signal secrets
- De-obfuscation of decomposed PII
- File and line number per finding
Built for the agent loop
POST /api/agent/code is part of the same scoped-key API an agent uses to self-test and improve, so a code scan can run automatically before every deploy.
- POST /api/agent/code
- Scoped project API key (X-AgentLeak-Key)
- Re-scans the source declared in the agent card
- Pairs with the CI `--fail-under` gate
How it works
From raw trace to a fix, in four steps.
1Point at the source
Run the CLI against a local path, a .zip, or pass --repo owner/name to fetch a GitHub repository directly.
2Scan runs the hybrid pipeline
Regex, entropy and (optionally) Presidio and an LLM-judge scan every file, plus code-specific de-obfuscation and quasi-identifier correlation.
3Read the findings
Each finding lists the file, line, rule, data type and a redacted snippet, with an overall 0-100 code privacy score.
4Gate on the score
Pass --fail-under to exit non-zero when the code score drops below your threshold, exactly like the trace-analysis CI gate.
Scan a GitHub repo for hardcoded secrets
agentleak scan --repo acme/support-bot --branch main --fail-under 80
# Code privacy score: 74/100 — Conditional pass
# [L3] app/memory_adapter.py:42 hardcoded_api_key (secret, high-entropy)
Read the complete implementation guide →