Docs / Secret Scanner

Secret Scanner

Detect exposed secrets before attackers do. SlickEnv's 53-pattern engine scans files, git history, MCP configs, and AI-generated code — producing a security score from 0 to 100.

Overview

Running slickenv scan without any flags scans your .env file and any git-tracked files in the current directory. Add flags to expand coverage to your entire git history, MCP config files, or AI-generated code.

Basic Usage

$ slickenv scan

→ Scanning .env and tracked files...

  ✗ STRIPE_SECRET_KEY   stripe_live_key  (critical)  .env:3
  ⚠ DATABASE_URL        postgres://...   (high)      .env:8

  Score: 42/100  —  1 critical, 1 high, 0 medium

Flags

FlagDescription
--filesScan all files in the current directory (not just .env)
--gitScan git-tracked files only
--mcpScan MCP config files (mcp.json, .mcp/, .cursor/mcp.json)
--ai-generatedScan files in AI-generated code directories
--ciExit with code 1 if any critical or high findings — for CI pipelines
--fixInteractive mode to resolve findings one by one
--severityFilter output by severity level: critical, high, medium, info

Security Score

Each scan produces a score from 0 (many critical issues) to 100 (no findings). Scores are calculated by deducting points per finding weighted by severity:

SeverityDeductionExample
Critical-30 pointsLive Stripe secret key, AWS secret key
High-15 pointsGitHub token, database URL with password
Medium-5 pointsTest API keys, generic high-entropy strings
Info-1 pointSuspicious patterns worth reviewing

Pattern Examples

The scanner checks 53 patterns across these categories:

PatternSeverityMatches
AWS Access KeyCriticalAKIA[0-9A-Z]{16}
Stripe Live KeyCriticalsk_live_[0-9a-zA-Z]{24,}
GitHub TokenCriticalghp_[0-9a-zA-Z]{36}
OpenAI KeyCriticalsk-[0-9a-zA-Z]{48}
Private Key (PEM)Critical-----BEGIN.*PRIVATE KEY-----
Database URLHighpostgres://user:pass@host
JWT TokenMediumeyJ[0-9a-zA-Z_-]{10,}\.[0-9a-zA-Z_-]{10,}
Stripe Test KeyMediumsk_test_[0-9a-zA-Z]{24,}
Anthropic KeyCriticalsk-ant-[0-9a-zA-Z_-]{32,}
Generic SecretInfosecret.*=.*[A-Za-z0-9+/]{20,}

CI/CD Integration

Use slickenv scan --ci in your pipeline to block deployments when secrets are detected. The command exits with code 1 on any critical or high findings.

# .github/workflows/deploy.yml
- name: Scan for secrets
  env:
    SLICKENV_TOKEN: ${{ secrets.SLICKENV_TOKEN }}
  run: slickenv scan --ci