🐕 leashscan
Is your AI agent on a leash?
See what Claude Code, Cursor, Codex, Copilot, Windsurf and your MCP servers can actually reach: leaked secrets, YOLO permissions, risky MCP configs and invisible prompt injection. One command. Offline. Zero dependencies.
pipx run leashscan # or: uvx leashscan
Why this exists
You gave an AI agent a terminal, your files and a dozen MCP servers. Now ask yourself:
- Can it read your
.env,~/.aws/credentialsor unencrypted SSH key? (Yes, probably.) - Did someone's
AGENTS.mdor README hide invisible Unicode instructions your agent will happily follow? - Is that MCP server pulling
@latestfrom npm on every launch, as you? - Did a repo you cloned ship a
.claude/settings.jsonhook that runscurl … | sh? - Is "auto-approve everything" switched on somewhere you forgot about?
Secret scanners don't check agent configs. Agent tools don't check your secrets. leashscan checks both, in seconds, without sending a single byte anywhere.
What it checks
| Area | Examples |
|---|---|
| 🔑 Secrets in the workspace | OpenAI / Anthropic / AWS / GitHub / Stripe / Slack / HF keys, private keys, .env files not gitignored, hardcoded passwords |
🏠 Home folder credentials (--home) |
SSH keys with no passphrase, ~/.aws/credentials, kubeconfig tokens, npm/PyPI/Docker/gh tokens, keys in shell history |
| 🔌 MCP servers | plain-text tokens in configs, unpinned npx/uvx packages, filesystem servers rooted at / or ~, shell-exec servers, http:// remotes, docker --privileged, curl | sh installs |
| 🛂 Agent permissions | Claude Code bypassPermissions, Bash(*), auto-run repo hooks, enableAllProjectMcpServers; Codex danger-full-access; VS Code / Copilot auto-approve; Gemini CLI auto-accept |
| 🕵️ Prompt injection | invisible Unicode tag text (decoded so you can read it!), Trojan Source bidi chars, zero-width smuggling, hidden HTML comments aimed at AI, injection phrases in AGENTS.md, CLAUDE.md, .cursorrules and friends |
Supports configs from Claude Code, Claude Desktop, Cursor, VS Code / Copilot, Windsurf, Codex CLI, Gemini CLI, Roo and Cline.
Every finding comes with a specific fix, not just a warning.
Usage
leashscan # scan the current project
leashscan --home # + your home folder and global agent configs
leashscan ~/code/* # many repos, one combined report
leashscan -f html -o report.html # shareable report (great for security reviews)
leashscan -f sarif -o out.sarif # GitHub code scanning
leashscan -f json # pipe into anything
leashscan --fail-on high # non-zero exit for CI
leashscan --badge # get a README badge for your grade
False positive? Add a leashscan:ignore comment on or above the line, or list paths in .leashscanignore:
docs/security-talk.md # ignore everything in this file
README.md:INJ010 # ignore one rule in one file
Install it for good with pipx install leashscan or pip install leashscan.
Try it on a deliberately leaky project
git clone https://github.com/amisellati123/leashscan && cd leashscan
python demo/make_demo.py /tmp/leaky-app
leashscan /tmp/leaky-app
GitHub Action
Block risky agent configs and hidden prompt injection before they merge:
# .github/workflows/leashscan.yml
name: leashscan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
permissions: { contents: read, security-events: write }
steps:
- uses: actions/checkout@v5
- uses: amisellati123/leashscan@v0.1.3
with:
fail-on: high
You get a summary on every run, results in the Security tab, and a failed check when something high or critical shows up.
In your IDE
Works in the integrated terminal of VS Code, Cursor, JetBrains or anything else. For one-click runs, copy .vscode/tasks.json into your project and use Terminal → Run Task → leashscan.
For forward deployed engineers and security reviews
Rolling out AI agents at a customer? The first question from their security team is "what will this thing be able to touch?" Run this on day one:
leashscan ~/client-repos/* --home -f html -o agent-exposure-report.html
- Safe on customer machines: read-only, fully offline, no telemetry, secrets always redacted
- Nothing to install beyond Python 3.9+ (standard library only, easy to vendor or audit, about 1,000 lines)
- One report for many repos, with a letter grade, severity counts and a concrete fix for every item
- Re-run after hardening and show the grade going from F → A
Grading
Each finding costs points by severity (critical 30, high 12, medium 4, low 1, with diminishing cost for repeats of the same rule). Any critical finding caps the grade at D.
A ≥ 90 · B ≥ 75 · C ≥ 60 · D ≥ 40 · F < 40
Got an A? Show it off:
[](https://github.com/amisellati123/leashscan)
Privacy
leashscan never makes a network request, never writes anything except the report file you ask for, and never prints a full secret. Read the source: it is small on purpose.
Responsible use
Scan machines and repositories you own or are authorized to assess. If you find exposed credentials in someone else's project, report them privately to the maintainers.
Contributing
New detection rules are the best contribution. Each scanner is a single file in src/leashscan/, and tests live in tests/. Ideas we'd love help with:
- more agent config formats (Zed, Continue, Amp, JetBrains AI)
- a
--fixmode that applies the safe changes automatically - a pre-commit hook and an npm wrapper (
npx leashscan)
pip install -e . pytest && pytest
License
MIT
Metadata
Release files for leashscan 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| leashscan-0.1.3.tar.gz | 32.9 kB | With provenance | Details for leashscan-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| leashscan-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for leashscan-0.1.3-py3-none-any.whl |
Total release size: 65.0 kB
Release files / leashscan-0.1.3.tar.gz
| Download URL | leashscan-0.1.3.tar.gz |
|---|---|
| Size | 32.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8703c63919b7fef89f81240c3064a1a001fdbfe68f35de99451b15ea916600e8
|
|
BLAKE2b-256 checksum How to use checksums |
9799b3ddc5258ad68c833e30617335092fe7abec49eb205d27084e40811d08be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / leashscan-0.1.3-py3-none-any.whl
| Download URL | leashscan-0.1.3-py3-none-any.whl |
|---|---|
| Size | 32.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83e6008e0b9f0ef61c3702ba53551d6c78c5ec91070918d8db8f1547e0219c05
|
|
BLAKE2b-256 checksum How to use checksums |
df83d87089bc1bfcbb37869422f3a7dc54a1f4d8489978ead41e59d4f95f75f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for leashscan 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for leashscan-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.