Open SourceApache-2.0 License

badgr-security-scan

Local-first scan for leaked secrets, unsafe defaults, prompt injection, and dangerous agent tools — no signup, nothing leaves your machine.

How it works

AI agents and LLM apps have a new class of security risks — leaked API keys in prompts, exec() calls in agent tools, and prompt injection phrases that hijack agent behavior. Standard linters don't catch these. badgr-security-scan does, in one command, with no setup.

1

Secret & unsafe-default scan

Flags API keys, tokens, and high-entropy values 16+ characters long, plus unsafe defaults like disabled TLS or auth bypasses.

2

Dangerous tool & prompt-injection scan

Detects shell-execution patterns (exec(), child_process, rm -rf) and phrases that hijack agent behavior, such as "ignore previous instructions".

3

Pass/fail report

Prints a readable report or --json output with exit code 1 on any risk found — ready to drop into CI or a pre-commit hook.

1

Install

Terminal
npx badgr-security-scan --text "$(cat src/agent.ts)"

Requires Node.js 18+.

2

Usage

Pass any text or code snippet with --text. Add --json for machine-readable output, or --no-prompt-injection to skip that check.

Terminal
npx badgr-security-scan --text "$(cat src/agent.ts)" --json

Example output

Terminal output
badgr-security-scan

  ✗  secret           API key or token found: API_KEY=sk_live_... (truncated)
  ✗  dangerous-tool   exec() call detected — dangerous in agent tool context
  ✓  unsafe-default   No unsafe auth defaults found
  ✓  prompt-injection No injection phrases found

  2 risks found. Review before deploying.

What's included

Leaked secret detection for API keys and tokens (16+ char values)
Unsafe-default detection (disabled TLS, auth bypasses)
Dangerous agent-tool pattern detection (exec(), child_process, rm -rf)
Prompt-injection phrase detection
Runs entirely offline — nothing is sent anywhere
--json output for CI and pre-commit hooks
Exit code 1 on any risk found
TypeScript API via runSecurityScan()
View on GitHub →

Ready to try badgr-security-scan?

npx badgr-security-scan --text "$(cat src/agent.ts)" — no account needed to get started.