Comprehensive security analysis tool that performs SAST/DAST scanning, dependency checks, secret detection, and license compliance verification.
Performs comprehensive security scanning including SAST, secrets detection, dependency vulnerability checks, and license compliance verification.
/plugin marketplace add rafaelkamimura/claude-tools/plugin install rafaelkamimura-claude-tools@rafaelkamimura/claude-toolsComprehensive security analysis tool that performs SAST/DAST scanning, dependency checks, secret detection, and license compliance verification.
Output: "Select security scan type:
Choose type (1-6):"
WAIT for user's choice.
Output: "Include SAST analysis? (y/n):" WAIT for user's response.
Output: "Check container images? (y/n):" WAIT for user's response.
Output: "Scan infrastructure code? (y/n):" WAIT for user's response.
Output: "Generate SBOM? (y/n):" WAIT for user's response.
Use Glob tool to identify project technologies:
package.json (JavaScript)requirements.txt or pyproject.toml (Python)go.mod (Go)Cargo.toml (Rust)pom.xml or build.gradle (Java)Gemfile (Ruby)composer.json (PHP)Use Glob tool to check for existing security tool configurations:
.semgrep.yml.snyk.gitleaks.tomlIf user requested SAST analysis:
Use Bash tool to get changed files:
git diff --name-only HEADUse Read tool to read each changed file
Use mcp__semgrep__semgrep_scan tool with file contents:
Parse results for vulnerabilities
Common Vulnerability Patterns
Framework-Specific Checks
# React/Vue XSS
- pattern: dangerouslySetInnerHTML={{...}}
severity: HIGH
# Express.js
- pattern: app.use(cors()) # without options
severity: MEDIUM
# Django
- pattern: DEBUG = True # in production
severity: CRITICAL
Scan for Secrets
# Common secret patterns
patterns:
- AWS: AKIA[0-9A-Z]{16}
- GitHub: ghp_[0-9a-zA-Z]{36}
- Generic API: api[_-]?key[_-]?=[\'\"][0-9a-zA-Z]{32,}
- Private Key: -----BEGIN (RSA|DSA|EC|PGP) PRIVATE KEY
- Password: password\s*=\s*[\'\"][^\'\"]+[\'\"]
Check Files
# High-risk files
.env
.env.local
config.json
settings.py
application.properties
docker-compose.yml
Secret Remediation
## Detected Secrets
⚠️ **Critical**: AWS Access Key found
- File: src/config.js:45
- Pattern: AKIAIOSFODNN7EXAMPLE
- Action: Move to environment variable
Suggested fix:
```javascript
// Instead of:
const AWS_KEY = "AKIAIOSFODNN7EXAMPLE";
// Use:
const AWS_KEY = process.env.AWS_ACCESS_KEY_ID;
Check Package Vulnerabilities
JavaScript/Node.js:
npm audit --json
npx snyk test
Python:
pip-audit
safety check
Go:
go list -m all | nancy sleuth
govulncheck ./...
Java:
mvn dependency-check:check
Vulnerability Report
## Dependency Vulnerabilities
### Critical (2)
| Package | Version | Vulnerability | Fix |
|---------|---------|---------------|-----|
| lodash | 4.17.19 | Prototype Pollution | Update to 4.17.21 |
| axios | 0.21.0 | SSRF | Update to 0.21.2 |
### High (3)
| Package | Version | CVE | CVSS |
|---------|---------|-----|------|
| express | 4.17.0 | CVE-2022-24999 | 7.5 |
Auto-Fix Dependencies
# Auto-update safe dependencies
npm audit fix
# Force updates (with caution)
npm audit fix --force
Scan Licenses
# Extract all licenses
license-checker --json > licenses.json
Check Compliance
allowed_licenses:
- MIT
- Apache-2.0
- BSD-3-Clause
- ISC
restricted_licenses:
- GPL-3.0
- AGPL-3.0
forbidden_licenses:
- Commercial
- Proprietary
License Report
## License Compliance
### Summary
- Total packages: 847
- Compliant: 832
- Warnings: 12
- Violations: 3
### Violations
| Package | License | Risk |
|---------|---------|------|
| some-lib | GPL-3.0 | Copyleft requirement |
| other-pkg | Unknown | Legal risk |
Scan Docker Images
# Scan with Trivy
trivy image myapp:latest
# Scan Dockerfile
hadolint Dockerfile
Check Base Images
# Vulnerable base image
FROM node:14-alpine # CVE-2023-xxxxx
# Suggested fix
FROM node:20-alpine
Runtime Security
# Security best practices
- Don't run as root
- Use minimal base images
- Remove unnecessary packages
- Scan at build time
- Sign images
Scan Terraform/CloudFormation
# Terraform
tfsec .
checkov -d .
# CloudFormation
cfn-lint template.yaml
Common IaC Issues
issues:
- S3 bucket public access
- Unencrypted databases
- Open security groups
- Missing logging
- Weak IAM policies
Aggregate Results
# Security Scan Report
## Executive Summary
- **Critical Issues**: 2
- **High Issues**: 5
- **Medium Issues**: 12
- **Low Issues**: 23
## Critical Findings
### 1. Hardcoded AWS Credentials
**File**: src/config.js:45
**Risk**: Account compromise
**Remediation**: Use AWS Secrets Manager
### 2. SQL Injection Vulnerability
**File**: api/users.js:78
**Risk**: Data breach
**Remediation**: Use parameterized queries
## Dependency Vulnerabilities
[Table of vulnerable packages]
## Secret Detection
[List of detected secrets]
## License Compliance
[Compliance status]
## Recommendations
1. Implement secret management system
2. Update vulnerable dependencies
3. Add security headers
4. Enable rate limiting
5. Implement CSP
## Compliance Status
- OWASP Top 10: ⚠️ Partial
- PCI DSS: ❌ Non-compliant
- GDPR: ⚠️ Review needed
Generate SARIF Output
{
"version": "2.1.0",
"runs": [{
"tool": {
"driver": {
"name": "SecurityScanner",
"version": "1.0.0"
}
},
"results": [...]
}]
}
Output: "Auto-fix available issues? (y/n):" WAIT for user's response.
Safe Auto-Fixes:
## Manual Fixes Required
### High Priority
1. **Replace hardcoded secrets**
- Move to .env file
- Use secret management service
- Rotate compromised credentials
2. **Fix SQL injection**
```javascript
// Vulnerable
db.query(`SELECT * FROM users WHERE id = ${userId}`);
// Fixed
db.query('SELECT * FROM users WHERE id = ?', [userId]);
/commit/mr-draft/deploycritical:
- Hardcoded secrets
- Remote code execution
- SQL injection
- Authentication bypass
high:
- XSS vulnerabilities
- Path traversal
- Insecure deserialization
- Outdated crypto
medium:
- Missing security headers
- Verbose error messages
- Weak password policy
- Missing rate limiting
low:
- Code quality issues
- Missing best practices
- Documentation gaps
block_on:
- critical_vulnerabilities: true
- high_vulnerabilities: count > 5
- secrets_detected: true
- license_violations: true
{
"scanners": {
"semgrep": true,
"gitleaks": true,
"trivy": true,
"snyk": false
},
"thresholds": {
"critical": 0,
"high": 5,
"medium": 20
},
"autoFix": {
"dependencies": true,
"headers": true,
"permissions": false
},
"ignorePaths": [
"node_modules/",
"test/",
".git/"
]
}
Shift Left Security
Defense in Depth
Risk Management
Continuous Monitoring
/security-scanSecurity-focused code scan. Checks for hardcoded secrets, vulnerable dependencies, and common security issues.