security-review
Skill1 starsChanged 9 months agoApache-2.0View on GitHub
Code security review covering OWASP Top 10, injection prevention (SQL, XSS, command injection), authentication and authorization patterns, secrets management, dependency vulnerability scanning, input validation, CORS, CSRF, rate limiting, and security headers. Language-agnostic with examples in JavaScript, Python, and Go. Use when reviewing code for security or hardening an application.
- Reads credentials
187 other projects use a version of this.
Adopted by
Most recently taken up by
- rafaelob/pragmatic-agent-skillstheir own version, first seen Oct 5, 2026
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- CaseyLabs/kc-secure-repo-templatetheir own version, first seen Oct 4, 2026
- HMBSbige/skillstheir own version, first seen Oct 3, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- hahuyhungdev/ai-coding-configtheir own version, first seen Oct 2, 2026
Used with
Projects with it also use kotlin-testing, configure-ecc and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tpavanipradeepSkillkotlin-testing
Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.
Also in 6 projects that use this
saxon-ySkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
InfopibeSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 12 projects that use this
InfopibeSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 10 projects that use this
mryeastcodeSkillpytorch-patterns
PyTorch deep learning patterns and best practices for building robust, efficient, and reproducible training pipelines, model architectures, and data loading.
Also in 9 projects that use this
berntpoppSkilldependency-cve-sweep
Use when handling Dependabot PRs, CodeQL/Trivy alerts, or doing a routine dependency/CVE sweep for this repo.
Also in 5 projects that use this
Other versions187 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 187
- github/awesome-copilot★ 40ksame name
- WorldFlowAI/everything-claude-code★ 4ksame name
- compozy/compozy★ 2.8ksame name
- getsentry/sentry-python★ 2.2ksame name
- xu-xiang/everything-claude-code-zh★ 2ksame name
- codeaholicguy/ai-devkit★ 1.6ksame name
- getsentry/skills★ 1ksame name
- microsoft/power-platform-skills★ 961same name
- thesongzhu/Friday★ 837same name
- ktnyt/cclsp★ 675same name
177 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- accessibility-wcagSkill
- api-designSkill
- api-testingSkill
- asset-optimizationSkill
- audio-systemsSkill
- aws-essentialsSkill
- ci-cd-pipelinesSkill
- codebase-analysisSkill
- code-reviewerSkill
- container-securitySkill
- cost-optimizationSkill
- database-designSkill
- data-visualizationSkill
- doc-generationSkill
- docker-kubernetesSkill
- docxSkill
- email-notificationsSkill
- env-configSkill
- flutter-mobileSkill
- framer-motionSkill
- frontend-code-reviewSkill
- frontend-designSkill
- fullstack-developerSkill
- game-enginesSkill
- gameplay-designSkill
- game-programming-languagesSkill
- game-serversSkill
- git-workflowSkill
- godot-4Skill
- golang-proSkill
- go-linter-configurationSkill
- graphics-renderingSkill
- i18n-localizationSkill
- incident-responseSkill
- level-designSkill
- llm-integrationSkill
- local-securitySkill
- memory-managementSkill
- monetization-systemsSkill
- monitoring-observabilitySkill
- multiplayer-netcodeSkill
- nextjs-16Skill
- notebooklm-researchSkill
- npm-packageSkill
- oauth-authSkill
- particle-systemsSkill
- performance-optimizationSkill
- playwright-testingSkill
- postgres-advancedSkill
- programming-architectureSkill
- project-migrationSkill
- publishing-platformsSkill
- python-best-practicesSkill
- react-nativeSkill
- redis-patternsSkill
- refactoring-patternsSkill
- remotion-best-practicesSkill
- rust-best-practicesSkill
- scraping-automationSkill
- seo-metaSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 165 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 121
Never store JWTs in localStorage (XSS-accessible).
- Distinctive: line 122
Never put sensitive data in JWT payload (it's base64, not encrypted).
- Very specific: line 123
Always validate the alg header server-side.
- Distinctive: line 160
IDOR prevention: Always check that the authenticated user owns or has permission to access the resource identified by the URL parameter.
- Distinctive: line 181
Runtime secrets: Use environment variables or a secrets manager (AWS SSM, Vault, Doppler).
- Distinctive: line 194
Add new secret to secrets manager
- Distinctive: line 196
Update clients to use new secret
- Distinctive: line 197
Remove old secret after grace period (24-48 hours)
“Common” is measured: kept by at least 6 in 10 of the 165 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are a security engineer specializing in application security, code review, and vulnerability prevention across web, API, and systems code.
Use this skill when
- Reviewing code for security vulnerabilities
- Hardening authentication, authorization, or input handling
- Setting up security headers, CORS, CSRF protection
- Configuring dependency scanning or secrets management
- Designing rate limiting or abuse prevention
OWASP Top 10 Quick Reference
| # | Vulnerability | Primary Defense |
| A01 | Broken Access Control | Deny by default, server-side checks on every request |
| A02 | Cryptographic Failures | TLS everywhere, bcrypt/argon2 for passwords, no secrets in code |
| A03 | Injection | Parameterized queries, context-aware output encoding |
| A04 | Insecure Design | Threat modeling, secure defaults, least privilege |
| A05 | Security Misconfiguration | Minimal installs, disable defaults, automate config |
| A06 | Vulnerable Components | SCA scanning (dependabot/snyk), pin versions, update regularly |
| A07 | Auth Failures | MFA, credential stuffing protection, secure session management |
| A08 | Data Integrity Failures | Verify signatures, use SRI, secure CI/CD |
| A09 | Logging Failures | Log security events, don't log secrets, monitor alerts |
| A10 | SSRF | Allowlist outbound hosts, validate/sanitize URLs |
Injection Prevention
SQL Injection
# BAD: string concatenation
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# GOOD: parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
# GOOD: ORM (SQLAlchemy)
user = session.query(User).filter(User.id == user_id).first()// BAD: template literal in query
db.query(`SELECT * FROM users WHERE email = '${email}'`);
// GOOD: parameterized
db.query("SELECT * FROM users WHERE email = $1", [email]);// BAD: fmt.Sprintf in query
db.Query(fmt.Sprintf("SELECT * FROM users WHERE id = %d", id))
// GOOD: parameterized
db.Query("SELECT * FROM users WHERE id = $1", id)XSS Prevention
// BAD: innerHTML with user data
element.innerHTML = userInput;
// GOOD: textContent (no HTML parsing)
element.textContent = userInput;
// React: NEVER use dangerouslySetInnerHTML with user data
// If you must render HTML, sanitize with DOMPurify:
import DOMPurify from "dompurify";
<div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(html) }} />
// CSP header to block inline scripts:
// Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'Command Injection
# BAD: shell=True with user input
subprocess.run(f"convert {filename} output.png", shell=True)
# GOOD: pass args as list, no shell
subprocess.run(["convert", filename, "output.png"], shell=False)
# GOOD: validate input against allowlist
ALLOWED = re.compile(r'^[a-zA-Z0-9_\-]+\.png$')
if not ALLOWED.match(filename):
raise ValueError("Invalid filename")Authentication Patterns
Password Hashing
# Use argon2 (preferred) or bcrypt. NEVER MD5/SHA for passwords.
from argon2 import PasswordHasher
ph = PasswordHasher(time_cost=3, memory_cost=65536, parallelism=4)
hash = ph.hash(password)
ph.verify(hash, password) # raises on mismatchJWT Best Practices
// Sign with RS256 (asymmetric) for services, HS256 for simple apps
const token = jwt.sign(
{ sub: user.id, role: user.role },
privateKey,
{ algorithm: "RS256", expiresIn: "15m" } // short-lived access tokens
);
// ALWAYS validate: algorithm, expiration, issuer, audience
const payload = jwt.verify(token, publicKey, {
algorithms: ["RS256"], // prevent algorithm confusion attack
issuer: "myapp",
audience: "myapp-api",
});JWT rules:
- Access tokens: 15 min max. Refresh tokens: days, stored server-side, rotatable.
- Never store JWTs in localStorage (XSS-accessible). Use httpOnly, Secure, SameSite=Strict cookies.
- Never put sensitive data in JWT payload (it's base64, not encrypted).
- Always validate the
algheader server-side. Rejectnonealgorithm.
Session Security
// Express session config
app.use(session({
secret: process.env.SESSION_SECRET, // 32+ random bytes
name: "__Host-sid", // __Host- prefix enforces Secure + no Domain
cookie: {
httpOnly: true,
secure: true,
sameSite: "strict",
maxAge: 3600000, // 1 hour
},
resave: false,
saveUninitialized: false,
}));Authorization
Principle: deny by default, check on every request, server-side only.
# BAD: checking permissions client-side only
# BAD: checking only "is authenticated" without role/ownership check
# GOOD: middleware that checks ownership
async def get_document(request: Request, doc_id: int) -> Document:
doc = await db.get_document(doc_id)
if doc is None:
raise HTTPException(404) # don't reveal existence
if doc.owner_id != request.user.id and request.user.role != "admin":
raise HTTPException(404) # 404 not 403 to prevent enumeration
return docIDOR prevention: Always check that the authenticated user owns or has permission to access the resource identified by the URL parameter. Never trust client-supplied IDs without ownership verification.
Secrets Management
# NEVER commit secrets. Use .gitignore + pre-commit scanning.
# .gitignore
.env
*.pem
*.key
credentials.json
# Pre-commit: gitleaks
# .pre-commit-config.yaml
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaksRuntime secrets: Use environment variables or a secrets manager (AWS SSM, Vault, Doppler). Never hardcode. Never log secrets. Rotate regularly.
Secrets Rotation
Rotation schedule:
- API keys: Every 90 days
- Database passwords: Every 90 days or on personnel changes
- JWT signing keys: Every 6-12 months
- TLS certificates: Automated via Let's Encrypt (90-day expiry)
- Service account tokens: Every 30-90 days
Rotation process:
- Generate new secret (key/password/token)
- Add new secret to secrets manager
- Deploy code that supports BOTH old and new secrets
- Update clients to use new secret
- Remove old secret after grace period (24-48 hours)
# Example: Rotate database password with zero downtime
# 1. Generate new password
NEW_PASS=$(openssl rand -base64 32)
# 2. Update DB user with new password
psql -c "ALTER USER myapp PASSWORD '$NEW_PASS';"
# 3. Update secrets manager
aws ssm put-parameter --name /prod/db/password --value "$NEW_PASS" --overwrite
# 4. Rolling restart app servers to pick up new secret
kubectl rollout restart deployment/myapp
# 5. Verify all instances use new password before removing old one# GOOD: secrets from environment with validation
import os
def get_required_env(key: str) -> str:
value = os.environ.get(key)
if not value:
raise RuntimeError(f"Required env var {key} is not set")
return value
DATABASE_URL = get_required_env("DATABASE_URL")Security Headers
# Nginx or reverse proxy
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://api.example.com" always;CORS Configuration
// BAD: allow everything
app.use(cors({ origin: "*", credentials: true })); // credentials + wildcard = browser rejects
// GOOD: explicit allowlist
app.use(cors({
origin: ["https://myapp.com", "https://staging.myapp.com"],
methods: ["GET", "POST", "PUT", "DELETE"],
allowedHeaders: ["Content-Type", "Authorization"],
credentials: true,
maxAge: 86400,
}));CSRF Protection
For cookie-based auth (sessions), use the synchronizer token pattern or SameSite cookies:
// Option 1: SameSite=Strict cookies (sufficient for most apps)
// Option 2: CSRF token (needed if SameSite=Lax or cross-subdomain)
// Modern approach: csrf-csrf (csurf is deprecated)
import { doubleCsrf } from "csrf-csrf";
const { generateToken, doubleCsrfProtection } = doubleCsrf({
getSecret: () => process.env.CSRF_SECRET,
cookieName: "__Host-csrf",
cookieOptions: { httpOnly: true, secure: true, sameSite: "strict" },
getTokenFromRequest: (req) => req.headers["x-csrf-token"],
});
app.use(doubleCsrfProtection);
// Alternative: Double-submit cookie pattern (manual)
app.post("/api/action", (req, res) => {
const tokenFromCookie = req.cookies.csrfToken;
const tokenFromHeader = req.headers["x-csrf-token"];
if (tokenFromCookie !== tokenFromHeader) return res.status(403).send("CSRF validation failed");
// Process request
});Token-based auth (Bearer JWT in Authorization header) is inherently CSRF-safe because browsers don't auto-attach it.
Rate Limiting
// Express rate limiting
import rateLimit from "express-rate-limit";
// General API rate limit
app.use("/api/", rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100,
standardHeaders: true,
legacyHeaders: false,
keyGenerator: (req) => req.ip, // or req.user?.id for authenticated
}));
// Strict limit on auth endpoints
app.use("/api/auth/", rateLimit({
windowMs: 15 * 60 * 1000,
max: 5, // 5 login attempts per 15 min
skipSuccessfulRequests: true, // don't count successful logins
}));Dependency Scanning
# JavaScript: npm audit + Snyk
npm audit --production
npx snyk test
# Python: pip-audit or safety
pip-audit
safety check
# Go: govulncheck (official)
govulncheck ./...
# CI: GitHub Dependabot + CodeQL
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10Input Validation Checklist
- Validate on the server. Client-side validation is UX, not security.
- Allowlist over denylist. Define what IS valid, not what isn't.
- Validate type, length, range, and format for every input field.
- Reject unexpected fields (strict schema parsing with Pydantic/Zod).
- Sanitize for output context (HTML encode for HTML, SQL parameterize for SQL).
- File uploads: validate MIME type by content (not extension), limit size, store outside webroot, randomize filenames.
- URLs: validate scheme (https only), resolve and check against SSRF allowlist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

