Skip to main content

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

CI PyPI Python Dependencies License

pipx run leashscan            # or: uvx leashscan
leashscan output showing an F grade

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/credentials or unencrypted SSH key? (Yes, probably.)
  • Did someone's AGENTS.md or README hide invisible Unicode instructions your agent will happily follow?
  • Is that MCP server pulling @latest from npm on every launch, as you?
  • Did a repo you cloned ship a .claude/settings.json hook that runs curl … | 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.4
        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:

[![leashscan A](https://img.shields.io/badge/leashscan-A-brightgreen)](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 --fix mode 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.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leashscan 0.1.4
File Size Uploaded Provenance Actions
leashscan-0.1.4.tar.gz 35.3 kB With provenance Details for leashscan-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for leashscan 0.1.4
File Interpreter ABI Platform Actions
leashscan-0.1.4-py3-none-any.whl Python 3 none any Details for leashscan-0.1.4-py3-none-any.whl

Total release size: 68.7 kB

Release files / leashscan-0.1.4.tar.gz

Download URL leashscan-0.1.4.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1df43fcd90c8518d4436bd6914c9747383a19d5f4e998c2b04fd2f76b033e698
BLAKE2b-256 checksum
How to use checksums
bf8c9cfa90adba5313ce04b6a0f10156721f3208ea3a1f6d2a12d2fa781ea34f
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 log

Release files / leashscan-0.1.4-py3-none-any.whl

Download URL leashscan-0.1.4-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
109bbf1e044f23f636da72873f88970d68322b57ac5940e156b46a75c9e8b8e5
BLAKE2b-256 checksum
How to use checksums
755677875c9e468c5c66b4f14a3e309cf82c4f3462601b3945dd54a2b305905b
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 log

Security for leashscan 0.1.4

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.

Select from 2 files

Attestation for leashscan-0.1.4.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 log

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

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page