ToolFence Scan — pre-install security for AI coding agents.

Scan Cursor / Claude / GitHub Copilot skills, instructions, prompts, and MCP configs for prompt injection, hidden Unicode, credential risks, and over-broad permissions before you trust them.

Part of ToolFence:

Scan what you install → Gate what can hurt you → Radar on cost and risk.

npx toolfence-scan .

(skill-scan is also installed as a CLI alias.)

# From this package (fixtures include known-bad skills)
npx toolfence-scan ./fixtures --format text --fail-on high

Expect critical/high findings on the planted bad skills (and a non-zero exit).

Against your own repo:

npx toolfence-scan .
npx toolfence-scan . --format sarif --output results.sarif
npx toolfence-scan . --format html --output report.html
npx toolfence-scan . --fail-on high
npx toolfence-scan . --emit-gate-rules --output gate-rules.json

Full walkthrough: Scan → Gate.

| Kind | Examples | |---|---| | Skills | SKILL.md ,.cursor/skills/** ,.github/skills/** ,.claude/skills/** | | Cursor rules | .cursorrules ,.cursor/rules/** | | Agents | AGENTS.md ,CLAUDE.md ,GEMINI.md | | GitHub Copilot | .github/copilot-instructions.md ,.github/instructions/*.instructions.md ,.github/prompts/*.prompt.md ,.github/agents/*.md | | MCP | .cursor/mcp.json ,.vscode/mcp.json ,mcp.json ,claude_desktop_config.json |

Also: toolfence-scan inventory . lists discovered files by kind before rules run.

See RULES.md for the full catalog.

| Rule | Severity | Catches | |---|---|---| | hidden-unicode | high | Bidi / zero-width concealment | | prompt-injection | critical | Ignore-previous / jailbreak / disable safety | | hide-from-user | critical | Conceal actions / run without confirmation | | credential-exfil | critical | Secret reads / send-credentials language | | hardcoded-secret | critical | AWS/GitHub/OpenAI/Slack/Google key shapes | | network-exfil | high | Paste/callback hosts, Discord webhooks, raw IPs | | mcp-overbroad | high | Wildcard tools, auto-approve, shell MCP | | remote-exec | high | curl \| bash ,iwr \| iex |

Suppress a line with # skill-scan-ignore / # skill-scan-ignore-next-line, or add globs to .skill-scanignore.

High/critical findings can emit a Rules fragment for Gate:

npx toolfence-scan . --emit-gate-rules --output gate-rules.json

Includes policy.*, ready-to-paste paste.deny_tools / paste.tool_overrides_json, and how_to_apply steps (also printed to stderr). Merge carefully into Inbox → Rules — don’t blind-overwrite production policy.

Guide: Scan → Gate.

- run: npx toolfence-scan . --format sarif --output skill-scan.sarif --fail-on high
- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: skill-scan.sarif

This monorepo also runs .github/workflows/skill-scan.yml against the package build.

git clone https://github.com/StockGorilla/skill-scan.git
cd skill-scan
npm install
npm test          # build + fixture self-test (expects findings)
node dist/cli.js --help

(Also vendored in the ToolFence monorepo under packages/skill-scan.)

toolfence-scan@0.1.3 — OSS wedge for ToolFence Scan. Scoped alias @toolfence/scan can follow when the npm org lands.

Note: The unscoped name skill-scan is blocked on npm (too similar to existing skillscan).

原文来源:github.com