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

Inside the capability

Three views of how it works.

SOURCE-TO-TRACE SCAN
agent.pysrcagent.pytools.pytests383940414243L4 · SECRETlogger.py:42

Find the leak before runtime

Inspect the repository, link each finding to its exact file and line, then carry that evidence into the runtime trace.

SOURCE TO SINK
READvault.emailGUARDredact()SINKcrm.sendsourcepolicy boundarythird party

Map how code can disclose data

Link the read point to logging, tool and third-party sinks so the fix happens at the correct boundary.

PATCH VERIFICATION
PATCH · agent.py1 / 1− 41crm.send(customer.email)+ 41crm.send(redact(email))code privacy score62 → 94

Prove the remediation in the diff

Compare the unsafe call with its redacted replacement and re-score the repository before merge.

GitHub-native privacy automation

Turn every code change into a privacy checkpoint.

Scan every pull request

Run AgentLeak static analysis on pull requests and merge queues before sensitive code lands.

Auto-gate risky changes

Fail CI automatically when the code privacy score falls below the threshold set for the repository.

Branch-specific policies

Apply stricter secret, PII and third-party-send rules to production and release branches.

Review remediation status

Keep findings, reviewers and the current privacy gate attached to the exact commit in GitHub.

The mental model

A secret hardcoded once is a leak in every future run.

Trace analysis catches what an agent does at runtime; static code scan catches what is already sitting in its source, waiting to be read, logged or sent to a third party. Running both closes the gap between what the agent was written to do and what it actually did in production.

Before

A hardcoded key or a debug print of raw PII waits, undetected, for the first run that exercises that code path.

With AgentLeak

The scan flags the exact file and line before the agent is ever deployed.

  • The same 3-tier pipeline as trace analysis: regex, Presidio, LLM-judge
  • Redacted snippets are shown, never the raw secret itself
  • One scan id per submission, comparable across commits

How it works

From raw trace to a fix, in four steps.

1

Point at the source

Run the CLI against a local path, a .zip, or pass --repo owner/name to fetch a GitHub repository directly.

2

Scan 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.

3

Read the findings

Each finding lists the file, line, rule, data type and a redacted snippet, with an overall 0-100 code privacy score.

4

Gate 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 →

Make privacy operations self-driving

“A privacy issue gets fixed when the finding is tied to the exact file, line, trace and release gate.”

Code-to-trace evidenceOne remediation path from source to runtime

“Teams should not have to choose between shipping quickly and proving that agents handle sensitive data safely.”

Fast, auditable releasesAgentLeak product principle

FAQ

Questions, answered.

Ready when you are

Test the path, not only the answer.

Create a local workspace, run a bundled scenario, then wire AgentLeak into CI or let your agent onboard itself.