Skip to main content
command CX Codex

security-scan · cloudai-x — Claude Code command: secrets, CVEs, risky patterns

security-scan is a command for Claude Code that checks a repository for hardcoded secrets, vulnerable dependencies, injection, XSS and weak config before a commit or PR.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/security-scan.md
Open on GitHub

What security-scan does

Four passes over the repo. The first one greps for credentials typed straight into source: passwords, tokens, API keys, across JS, TS, Python, Go, Java, Ruby, JSON and YAML files. It also looks at .env* files with templates skipped, AWS key IDs and private key files such as *.pem, *.key and id_rsa.

Then a dependency audit runs through whatever the project already uses: npm audit or yarn audit, pip-audit or safety check, govulncheck ./..., cargo audit. After that the command reads code for injection and XSS shapes: SQL built by string concatenation, exec, system or subprocess fed with user input, innerHTML and dangerouslySetInnerHTML left unsanitised, file paths taken from input without a .. check.

The last pass is a config checklist: debug mode off in production, HTTPS only, CORS, headers like CSP and X-Frame-Options, no default passwords. Results come back as PASS, FAIL or WARNINGS with counts. Each finding carries a file, a line and a fix; vulnerable packages get severity, CVE number and the version that resolves them.

Those audit tools have to be installed, and their stderr goes to 2>/dev/null. A missing pip-audit or cargo audit leaves that section empty, so the report ends up looking cleaner than the code.

What it helps with

  • catch a token pasted into source before it reaches a push
  • check dependencies for known CVEs before a release
  • spot SQL string concatenation and exec calls fed with user input
  • walk the config checklist: debug mode, HTTPS, CORS, headers
  • get a report with file and line instead of a vague warning

Example prompts for the agent

  • Run /project-starter:security-scan on the repo before I commit.
  • Run /project-starter:security-scan and show only the critical findings.
  • Run /project-starter:security-scan, then tell me which versions fix the CVEs it found.

How to install security-scan

Manually: put the files in place

.claude/commands/security-scan.md

Call it with /security-scan. For all projects use ~/.claude/commands/

Questions about security-scan

How do I install security-scan in Claude Code?

Place the command file at .claude/commands/security-scan.md and it becomes available in the project. Inside the project-starter plugin you call it with the namespace: /project-starter:security-scan.

What does security-scan do?

It looks for hardcoded secrets, audits dependencies for known vulnerabilities, reviews code for injection and XSS, and checks config against a checklist. The output is a report marked PASS, FAIL or WARNINGS.

What does the dependency audit need?

An audit tool for the project's language: npm audit or yarn audit, pip-audit or safety check, govulncheck, cargo audit. Without one installed that check returns nothing, since its error is sent to 2>/dev/null.

Source text

security-scan.md · MIT
---
description: Security-focused code scan. Checks for hardcoded secrets, vulnerable dependencies, and common security issues.
---

# Security Scan

Security-focused code scanning. Run before commits and PRs to catch vulnerabilities.

## Phase 1: Secret Detection

Scan for hardcoded credentials:

```bash
# Common secret patterns (-E: extended regex, so ? and {n} work)
grep -rnE "(password|passwd|secret|token|api[_-]?key)[[:space:]]*[=:][[:space:]]*['\"]" --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" --include="*.py" --include="*.go" --include="*.java" --include="*.rb" --include="*.json" --include="*.yml" --include="*.yaml" --exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null

# Secrets in .env files (templates excluded)
grep -rnE "^[A-Za-z0-9_]*(PASSWORD|SECRET|TOKEN|API_KEY)[A-Za-z0-9_]*=.+" --include=".env*" --exclude=".env.example" --exclude=".env.template" --exclude=".env.sample" --exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null

# AWS keys
grep -rnE "AKIA[0-9A-Z]{16}" --exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null

# Private keys
find . \( -name "*.pem" -o -name "*.key" -o -name "id_rsa" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null
```

## Phase 2: Dependency Audit

Check for vulnerable dependencies:

### Node.js

```bash
npm audit --json 2>/dev/null | head -100
# or
yarn audit --json 2>/dev/null | head -100
```

### Python

```bash
pip-audit 2>/dev/null || safety check 2>/dev/null
```

### Go

```bash
govulncheck ./... 2>/dev/null
```

### Rust

```bash
cargo audit 2>/dev/null
```

## Phase 3: Code Pattern Analysis

Check for dangerous patterns:

### SQL Injection

- String concatenation in SQL queries
- Unparameterized queries
- Dynamic table/column names from user input

### Command Injection

- Shell execution with user input (`exec`, `system`, `subprocess`)
- Unsanitized path construction

### XSS Vulnerabilities

- `innerHTML` with user data
- `dangerouslySetInnerHTML` without sanitization
- Unescaped template variables

### Path Traversal

- User input in file paths without sanitization
- Missing `..` checks

## Phase 4: Configuration Check

Verify security settings:

- [ ] Debug mode disabled in production configs
- [ ] HTTPS enforced (no HTTP URLs in prod)
- [ ] CORS properly configured
- [ ] Security headers present (CSP, X-Frame-Options, etc.)
- [ ] No default/weak passwords in configs

## Output Format

```
## Security Scan: [PASS/FAIL/WARNINGS]

### Secrets Detected: [count]
1. **CRITICAL** - `file:line`
   - Type: [API key/password/token/private key]
   - Action: Remove immediately and rotate credential

### Vulnerable Dependencies: [count]
1. **[package@version]** - Severity: [Critical/High/Medium/Low]
   - CVE: [CVE number if available]
   - Fixed in: [version]
   - Action: Update to [version]

### Code Vulnerabilities: [count]
1. **[Vulnerability Type]** - `file:line`
   - Risk: [description]
   - Fix: [remediation steps]

### Configuration Issues: [count]
1. **[Issue]**
   - Current: [state]
   - Recommended: [secure state]

### Recommendations
1. [Prioritized action items]
```

## NEVER Commit If

- Secrets detected in code (rotate and remove)
- Critical CVEs in dependencies (update first)
- Obvious injection vulnerabilities (fix first)

## Usage

This command ships with the project-starter plugin. Invoke with: `/project-starter:security-scan`

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar slash commands

All slash commands for Security →

security-scan by other authors comes first.

security-scan alirezarezvani The security-scan command scans code for leaked secrets via gitleaks, checks Python dependencies with safety, and dispatches a GitHub Actions audit. CX Codex +1 ★ 907repo stars deep-security-scan official openai deep-security-scan is a Claude Code skill that runs deep, multi-pass repository security audits, combining findings until consecutive scans reveal nothing new. CX Codex +1 127installs Next.js Security Scan sugarforever Next.js Security Scan is a Claude Code skill that checks Next.js and TypeScript/JavaScript projects for security flaws. Run it for code reviews, security audits, or checks before deployment. CX Codex +1 580installs secrets-scan OWASP secrets-scan scans source and config files for hardcoded credentials, API keys and tokens, whether you are reviewing before a merge or auditing a repo. CX Codex +1 427installs vibe-security Chris Raroque vibe-security — a skill that audits apps built fast with an AI assistant: leaked keys, broken database access rules, and trust placed in values coming from the client. CX Codex +1 3,900installs mcp-security-audit official github mcp-security-audit scans .mcp.json files for hardcoded secrets, shell injection patterns, and unpinned package dependencies. Runs before commits or when onboarding new MCP servers to a repository. CX Codex +1 1,100installs security-auditor zhaono1 security-auditor — a skill that hunts vulnerabilities in your code: walks the OWASP Top 10, checks configs, dependencies and leaked secrets. Useful before a release or a review. CX Codex +1 1,100installs

From the same set46

The whole set →

Project sponsors

Companies that keep this analytics open