skills/consiliency/security-audit/SKILL.md
Detect common security vulnerabilities in code. Covers OWASP patterns, SQL injection, bare excepts, shell injection. Framework-agnostic.
npx skillsauth add aiskillstore/marketplace security-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Detect common security vulnerabilities during code review and development. Based on OWASP guidelines and common vulnerability patterns.
This skill is framework-generic. It provides universal security patterns:
| Variable | Default | Description | |----------|---------|-------------| | SEVERITY_THRESHOLD | medium | Minimum severity to report | | SCAN_DEPTH | 3 | Directory depth for scanning | | INCLUDE_TESTS | false | Include test files in scan |
MANDATORY - Follow the Workflow steps below in order.
If you're about to:
except: blocksSTOP -> Use parameterized queries -> Add specific exception handling -> Then proceed
./cookbook/sql-injection.md./cookbook/bare-except.md./cookbook/shell-injection.mdBAD - String concatenation:
# VULNERABLE
query = f"SELECT * FROM users WHERE id = {user_id}"
cursor.execute(query)
query = "SELECT * FROM users WHERE name = '" + name + "'"
GOOD - Parameterized queries:
# SAFE
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
# SQLAlchemy
session.query(User).filter(User.id == user_id).first()
# Prisma
await prisma.user.findUnique({ where: { id: userId } })
BAD - Catches everything:
# VULNERABLE - hides bugs, catches KeyboardInterrupt
try:
risky_operation()
except:
pass
# VULNERABLE - too broad
except Exception:
log.error("Something failed")
GOOD - Specific exceptions:
# SAFE - specific exceptions
try:
risky_operation()
except ValueError as e:
log.warning(f"Invalid value: {e}")
except ConnectionError as e:
log.error(f"Connection failed: {e}")
raise
BAD - User input in shell:
# VULNERABLE
os.system(f"grep {user_input} /var/log/app.log")
import subprocess
subprocess.run(f"ls {directory}", shell=True)
GOOD - Avoid shell, use lists:
# SAFE - no shell
subprocess.run(["grep", user_input, "/var/log/app.log"])
# SAFE - validated input
if not re.match(r'^[a-zA-Z0-9_-]+$', directory):
raise ValueError("Invalid directory name")
subprocess.run(["ls", directory])
BAD - User input in paths:
# VULNERABLE
path = f"/uploads/{user_filename}"
with open(path) as f:
return f.read()
GOOD - Validate and sanitize:
# SAFE
from pathlib import Path
upload_dir = Path("/uploads").resolve()
requested = (upload_dir / user_filename).resolve()
if not requested.is_relative_to(upload_dir):
raise ValueError("Path traversal attempt")
with open(requested) as f:
return f.read()
BAD - Secrets in code:
# VULNERABLE
API_KEY = "sk-1234567890abcdef"
DB_PASSWORD = "super_secret_password"
GOOD - Environment variables:
# SAFE
import os
API_KEY = os.environ["API_KEY"]
DB_PASSWORD = os.environ["DB_PASSWORD"]
# Or with defaults for development
API_KEY = os.getenv("API_KEY", "dev-key-only")
BAD - Unsanitized output:
<!-- VULNERABLE -->
<div>{{ user_input }}</div>
GOOD - Proper escaping:
<!-- SAFE - auto-escaped in most frameworks -->
<div>{{ user_input | e }}</div>
<!-- Or use textContent in JS -->
element.textContent = userInput; // Safe
| Severity | Impact | Examples | |----------|--------|----------| | CRITICAL | Data breach, RCE | SQL injection, shell injection | | HIGH | Data exposure, privilege escalation | Path traversal, hardcoded secrets | | MEDIUM | Information disclosure | Verbose errors, bare excepts | | LOW | Best practice violation | Missing input validation |
VULNERABLE_PATTERNS = {
"sql_injection": [
r'execute\([\'"].*%s.*[\'"].*%', # % formatting in SQL
r'execute\(f[\'"]', # f-string in SQL
r'execute\([\'"].*\+', # String concat in SQL
],
"shell_injection": [
r'os\.system\(', # os.system
r'subprocess\..*shell=True', # shell=True
r'eval\(', # eval
r'exec\(', # exec
],
"bare_except": [
r'except\s*:', # bare except
],
"hardcoded_secrets": [
r'password\s*=\s*[\'"]', # password = "..."
r'api_key\s*=\s*[\'"]', # api_key = "..."
r'secret\s*=\s*[\'"]', # secret = "..."
],
}
const VULNERABLE_PATTERNS = {
sqlInjection: [
/`SELECT.*\$\{/, // Template literal in SQL
/"SELECT.*" \+ /, // String concat in SQL
],
xss: [
/innerHTML\s*=/, // innerHTML assignment
/dangerouslySetInnerHTML/, // React dangerous prop
],
shellInjection: [
/exec\([`'"]/, // child_process.exec
/spawn\(.*shell:\s*true/, // shell: true
],
};
Check these high-risk areas first:
- Authentication/authorization code
- Database queries
- File operations
- External API calls
- User input handling
- Serialization/deserialization
For each source file:
Match against vulnerability patterns
Record file, line, pattern matched
Assess severity
# Security Audit Report
## Summary
- CRITICAL: 2
- HIGH: 5
- MEDIUM: 12
## Critical Issues
### 1. SQL Injection in user_service.py:45
Pattern: f-string in execute()
```python
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
Fix: Use parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
## Integration
### With /ai-dev-kit:execute-lane
Run security audit in code-related lanes:
```markdown
Lane: SL-API
Post-implementation checks:
1. ✓ Tests pass
2. ✓ Lint clean
3. ⚠️ Security audit: 2 MEDIUM issues
Review security findings before merge.
- name: Security Audit
run: |
# Check for vulnerable patterns
grep -rn "execute(f" --include="*.py" && exit 1 || true
grep -rn "shell=True" --include="*.py" && exit 1 || true
grep -rn "except:" --include="*.py" && echo "Warning: bare except found"
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.