agentleFS
camilooscargbaptistacamilooscargbaptista/cto-toolkit/security-review/SKILL.md

security-review

Skill9 starsChanged 8 months agoMITView on GitHub

**Security Code Review**: Reviews code for security vulnerabilities including authentication (OAuth2, JWT), authorization (RBAC, roles), API security, data protection, payment security, and common attack vectors. Use whenever the user wants a security review, penetration test analysis, threat model, or mentions OAuth2, JWT, authentication, authorization, RBAC, roles, permissions, CORS, CSRF, XSS, SQL injection, secrets management, encryption, PCI, or asks about securing their application. Also trigger when reviewing payment flows, financial transactions, or handling sensitive user data.

  • Reads credentials

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-cve-sweep, fleet-standard-adoption 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.
  • berntpoppSkill

    dependency-cve-sweep

    Use when handling Dependabot PRs, CodeQL/Trivy alerts, or doing a routine dependency/CVE sweep for this repo.

    Also in 12 projects that use this

  • berntpoppSkill

    fleet-standard-adoption

    Use when bringing this repo into compliance with a GeneFoundry fleet standard (tool-naming, response-envelope, container-hardening, versioning, MCP transport, or logging) or closing its tracking issue.

    Also in 12 projects that use this

  • HABUBUSSSkill

    project-guidelines-example

    Also in 20 projects that use this

  • niloykumarbarmanSkill

    agent-sort

    Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

    Also in 15 projects that use this

  • junimnjwSkill

    ralphinho-rfc-pipeline

    RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.

    Also in 17 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 7 projects that use this

  • +2 more from berntpopp

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 165 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No password in logs or error messages

    line 57
  2. Distinctive:

    No privilege escalation through parameter manipulation

    line 64
  3. Distinctive:

    No audit trail for permission changes

    line 89
  4. Distinctive:

    No sensitive data in URLs or query parameters

    line 100
  5. Distinctive:

    All monetary calculations use integer cents or BigDecimal (NEVER float)

    line 124
  6. Distinctive:

    No secrets in Docker images or CI logs

    line 151
  7. Distinctive:

    No hardcoded credentials in Dockerfiles

    line 158
  8. Distinctive:

    No secrets in message payloads

    line 171

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Code Review

You are a senior security engineer reviewing code for vulnerabilities. Your goal is to identify real risks (not theoretical ones), prioritize by exploitability and impact, and provide actionable fixes.

Review Framework

1. Authentication

OAuth2 checks:

  • Authorization code flow for web apps (NOT implicit flow — deprecated)
  • PKCE for SPAs and mobile apps
  • State parameter to prevent CSRF
  • Token storage (httpOnly cookies, NOT localStorage for access tokens)
  • Proper redirect URI validation (exact match, no open redirects)
  • Refresh token rotation on use
  • Token revocation on logout

JWT checks:

❌ Common JWT vulnerabilities:
- Algorithm confusion (accepting "none" or switching RS256 → HS256)
- Missing expiration (exp claim)
- Not validating issuer (iss) and audience (aud)
- Storing sensitive data in payload (it's base64, not encrypted)
- Using JWT for session management without revocation strategy

✅ JWT security checklist:
- Algorithm explicitly set server-side (never trust the header)
- Short expiration (15 min for access tokens)
- Refresh tokens stored securely (httpOnly cookie or encrypted)
- Claims validated: iss, aud, exp, iat, nbf
- Signing key rotation strategy in place
- Token size reasonable (<8KB to avoid header overflow)

Password handling:

  • bcrypt/scrypt/Argon2 for hashing (NEVER MD5/SHA)
  • Minimum cost factor (bcrypt ≥12 rounds)
  • Rate limiting on login attempts
  • Account lockout after repeated failures
  • No password in logs or error messages

2. Authorization (RBAC / Roles)

Check for:

  • Authorization checked at EVERY endpoint (not just UI-level hiding)
  • Role checks at the data layer, not just the controller
  • No privilege escalation through parameter manipulation
  • Object-level authorization (user can only access their own resources)
  • Function-level authorization (admin endpoints not accessible to regular users)
❌ Insecure:
GET /api/users/123/orders    # Does it check that current user IS user 123?
PUT /api/orders/456          # Does it check ownership before modification?
DELETE /api/admin/users/789  # Does it verify admin role server-side?

✅ Secure:
// Middleware enforces role AND ownership
@Authorize(roles: ['admin', 'owner'])
async updateOrder(req) {
  const order = await orderRepo.findById(req.params.id);
  if (order.userId !== req.user.id && !req.user.isAdmin) {
    throw new ForbiddenError();
  }
}

Common RBAC anti-patterns:

  • Hardcoded roles in business logic (use permission-based checks)
  • Role checks only in UI (API must enforce independently)
  • Missing role hierarchy validation
  • No audit trail for permission changes
  • Shared admin accounts

3. API Security

Check for:

  • Rate limiting on all public endpoints
  • Input validation and sanitization on ALL user inputs
  • Content-Type validation (reject unexpected types)
  • Request size limits
  • CORS configuration (not Access-Control-Allow-Origin: * in production)
  • No sensitive data in URLs or query parameters
  • Proper HTTP method restrictions
  • API key rotation mechanism
  • Webhook signature verification

SQL Injection:

❌ Concatenated queries:
db.query(`SELECT * FROM users WHERE email = '${email}'`);

✅ Parameterized queries:
db.query('SELECT * FROM users WHERE email = $1', [email]);

XSS Prevention:

  • Output encoding on all user-supplied content
  • Content-Security-Policy headers
  • HttpOnly flag on session cookies
  • No dangerouslySetInnerHTML (React) or [innerHTML] (Angular) with user data

4. Payment & Financial Security

Mandatory checks:

  • PCI DSS compliance (never store raw card numbers)
  • All monetary calculations use integer cents or BigDecimal (NEVER float)
  • Idempotency keys on all payment operations
  • Webhook signature verification (Stripe, payment provider)
  • Double-entry bookkeeping for ledger integrity
  • Audit trail for every financial transaction
  • Amount validation server-side (don't trust client-submitted prices)
  • Currency precision handling
❌ float arithmetic:
const total = price * quantity; // 0.1 + 0.2 = 0.30000000000000004

✅ Integer cents:
const totalCents = priceCents * quantity;
const displayPrice = (totalCents / 100).toFixed(2);

5. Data Protection

Check for:

  • Encryption at rest for PII (database-level or field-level)
  • Encryption in transit (TLS 1.2+, no mixed content)
  • PII not logged (mask emails, never log passwords/tokens)
  • Data minimization (don't collect what you don't need)
  • Proper data deletion (GDPR/LGPD right to erasure)
  • Secrets not in code (use env vars, vault, parameter store)
  • .env files in .gitignore
  • No secrets in Docker images or CI logs

6. Infrastructure Security

Check for:

  • Container running as non-root user
  • Minimal base images (alpine, distroless)
  • No hardcoded credentials in Dockerfiles
  • Health check endpoints don't leak system info
  • Dependency vulnerabilities (npm audit, OWASP dependency-check)
  • Proper error messages (no stack traces in production)
  • Security headers (HSTS, X-Frame-Options, X-Content-Type-Options)

7. Messaging Security (Kafka, SQS, SNS)

Check for:

  • Message encryption for sensitive data
  • Access control on topics/queues
  • Message validation before processing (don't trust message content)
  • DLQ monitoring for suspicious patterns
  • No secrets in message payloads
  • Audit trail for message production/consumption

Severity Classification

SeverityDefinitionExamples
CriticalExploitable now, high impactSQL injection, auth bypass, exposed secrets
HighExploitable with some effortIDOR, privilege escalation, missing rate limit on auth
MediumRequires specific conditionsXSS in admin panel, verbose error messages
LowMinimal impact or hard to exploitMissing security headers, weak password policy

Output Format

## Security Assessment Summary
[Overall risk level, most critical finding, immediate actions needed]

## Critical Vulnerabilities
[Exploitable now — fix immediately before deploying]

## High Risk
[Significant vulnerabilities requiring prompt attention]

## Medium Risk
[Should be addressed in next sprint]

## Low Risk / Hardening
[Nice-to-have security improvements]

## Positive Security Practices
[What's already done well — reinforce good patterns]

## Recommendations
[Systematic improvements: tooling, processes, training]

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.