code-review-security

hieutrtr/ai1-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/hieutrtr/ai1-skills --skill code-review-security
0 commentsdiscussion
summary

Activate this skill when:

skill.md

Code Review Security

When to Use

Activate this skill when:

  • Reviewing pull requests for security vulnerabilities
  • Auditing authentication or authorization code changes
  • Reviewing code that handles user input, file uploads, or external data
  • Checking for OWASP Top 10 vulnerabilities in new features
  • Validating that secrets are not committed to the repository
  • Scanning dependencies for known vulnerabilities
  • Reviewing API endpoints that expose sensitive data

Output: Write findings to security-review.md with severity, file:line, description, and recommendations.

Do NOT use this skill for:

  • Deployment infrastructure security (use docker-best-practices)
  • Incident response procedures (use incident-response)
  • General code quality review without security focus (use pre-merge-checklist)
  • Writing implementation code (use python-backend-expert or react-frontend-expert)

Instructions

OWASP Top 10 Checklist

Review every PR against the OWASP Top 10 (2021 edition). Each category below includes specific checks for Python/FastAPI and React codebases.


A01: Broken Access Control

What to look for:

  • Missing authorization checks on endpoints
  • Direct object reference without ownership verification
  • Endpoints that expose data without role-based filtering
  • Missing Depends() for auth on new routes

Python/FastAPI checks:

# BAD: No authorization check -- any authenticated user can access any user
@router.get("/users/{user_id}")
async def get_user(user_id: int, db: Session = Depends(get_db)):
    return await user_repo.get(user_id)

# GOOD: Verify the requesting user owns the resource or is admin
@router.get("/users/{user_id}")
async def get_user(
    user_id: int,
    current_user: User = Depends(get_current_user),
    db: Session = Depends(get_db),
):
    if current_user.id != user_id and current_user.role != "admin":
        raise HTTPException(status_code=403, detail="Forbidden")
    return await user_repo.get(user_id)

Review checklist:

  • Every route has authentication (Depends(get_current_user))
  • Resource access is verified against the requesting user
  • Admin-only endpoints check role == "admin"
  • List endpoints filter by user ownership (unless admin)
  • No IDOR (Insecure Direct Object Reference) vulnerabilities

A02: Cryptographic Failures

What to look for:

  • Passwords stored in plaintext or with weak hashing
  • Sensitive data in logs or error messages
  • Hardcoded secrets, API keys, or tokens
  • Weak JWT configuration

Python checks:

# BAD: Weak password hashing
import hashlib
password_hash = hashlib.md5(password.encode()).hexdigest()

# GOOD: Use bcrypt via passlib
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
password_hash = pwd_context.hash(password)

# BAD: Secret in code
SECRET_KEY = "my-super-secret-key-123"

# GOOD: Secret from environment
SECRET_KEY = os.environ["SECRET_KEY"]

Review checklist:

  • Passwords hashed with bcrypt (never MD5, SHA1, or plaintext)
  • JWT secret loaded from environment, not hardcoded
  • Sensitive data excluded from logs (passwords, tokens, PII)
  • HTTPS enforced for all external communication
  • No secrets in source code (check .env.example has placeholders only)

A03: Injection

What to look for:

  • Raw SQL queries with string interpolation
  • eval(), exec(), compile() with user input
  • subprocess calls with shell=True
  • Template injection

Python checks:

# BAD: SQL injection via string formatting
query = f"SELECT * FROM users WHERE email = '{email}'"
db.execute(text(query))

# GOOD: Parameterized query
db.execute(text("SELECT * FROM users WHERE email = :email"), {"email": email})

# GOOD: SQLAlchemy ORM (always parameterized)
user = db.query(User).filter(User.email == email).first()

# BAD: Command injection
subprocess.run(f"convert {filename}", shell=True)

# GOOD: Pass arguments as a list
subprocess.run(["convert", filename], shell=False)

# BAD: Code execution with user input
result = eval(user_input)

# GOOD: Never eval user input. Use ast.literal_eval for safe parsing.
result = ast.literal_eval(user_input)  # Only for literal structures

Review checklist:

  • No raw SQL with string interpolation (use ORM or parameterized queries)
  • No eval(), exec(), or compile() with external input
  • No subprocess.run(..., shell=True) with dynamic arguments
  • No pickle.loads() on untrusted data
  • All user input validated by Pydantic schemas before use

A04: Insecure Design

What to look for:

  • Missing rate limiting on authentication endpoints
  • No account lockout after failed login attempts
  • Missing CAPTCHA on public-facing forms
  • Business logic flaws (e.g., negative amounts, self-privilege-escalation)

Review checklist:

  • Rate limiting on login, registration, and password reset
  • Account lockout or exponential backoff after 5+ failed attempts
  • Business logic validates constraints (positive amounts, valid transitions)
  • Sensitive operations require re-authentication

A05: Security Misconfiguration

What to look for:

  • Debug mode enabled in production
  • CORS configured with wildcard * origins
  • Default credentials or admin accounts
  • Verbose error messages exposing stack traces

Python/FastAPI checks:

# BAD: Wide-open CORS
app.add_middleware(CORSMiddleware, allow_origins=["*"])

# GOOD: Explicit allowed origins
app.add_middleware(
    CORSMiddleware,
    allow_origins=["https://app.example.com"],
    allow_methods=["GET", "POST", "PUT", "DELETE"],
    allow_headers=["Authorization", "Content-Type"],
)

# BAD: Debug mode in production
app = FastAPI(debug=True)

# GOOD: Debug only in development
app = FastAPI(debug=settings.DEBUG)  # DEBUG=False in production

Review checklist:

  • CORS origins are explicit (no wildcard in production)
  • Debug mode disabled in production configuration
  • Error responses do not expose stack traces or internal details
  • Default admin credentials are changed or removed
  • Security headers set (X-Content-Type-Options, X-Frame-Options, etc.)

A06: Vulnerable and Outdated Components

Review checklist:

  • No known CVEs in Python dependencies (pip-audit or safety check)
  • No known CVEs in npm dependencies (npm audit)
  • Dependencies pinned to specific versions in lock files
  • No deprecated packages still in use

A07: Identification and Authentication Failures

What to look for:

  • Weak password policies
  • Session tokens that do not expire
  • Missing multi-factor authentication for admin actions
  • JWT tokens without expiration

Python checks:

# BAD: JWT without expiration
token = jwt.encode({"sub": user_id}, SECRET_KEY, algorithm="HS256")

# GOOD: JWT with expiration
token = jwt.encode(
    {"sub": user_id, "exp": datetime.utcnow() + timedelta(minutes=30)},
    SECRET_KEY,
    algorithm="HS256",
)

Review checklist:

  • JWT tokens have expiration (exp claim)
  • Refresh tokens are stored securely and can be revoked
  • Password policy enforces minimum length (12+) and complexity
  • Session invalidation on password change or logout
  • No user enumeration via login error messages

A08: Software and Data Integrity Failures

Review checklist:

  • CI/CD pipeline validates artifact integrity
  • No unsigned or unverified packages
  • how to use code-review-security

    How to use code-review-security on Cursor

    AI-first code editor with Composer

    1

    Prerequisites

    Before installing skills in Cursor, ensure your development environment meets these requirements:

    • Cursor installed and configured on your development machine
    • Node.js version 16.0+ with npm package manager (verify with node --version)
    • Active project directory or workspace where you want to add code-review-security
    2

    Execute installation command

    Execute the skills CLI command in your project's root directory to begin installation:

    $npx skills add https://github.com/hieutrtr/ai1-skills --skill code-review-security

    The skills CLI fetches code-review-security from GitHub repository hieutrtr/ai1-skills and configures it for Cursor.

    3

    Select Cursor when prompted

    The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

    ◆ Which agents do you want to install to?
    │ ── Universal (.agents/skills) ── always included ────
    │ • Amp
    │ • Antigravity
    │ • Cline
    │ • Codex
    │ ●Cursor(selected)
    │ • Cursor
    │ • Windsurf
    4

    Verify installation

    Confirm successful installation by checking the skill directory location:

    .cursor/skills/code-review-security

    Reload or restart Cursor to activate code-review-security. Access the skill through slash commands (e.g., /code-review-security) or your agent's skill management interface.

    Security & Verification Notice

    We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

    Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.561 reviews
  • Pratham Ware· Dec 28, 2024

    Keeps context tight: code-review-security is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Henry Shah· Dec 28, 2024

    Registry listing for code-review-security matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Yuki Johnson· Dec 24, 2024

    I recommend code-review-security for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Layla Yang· Dec 24, 2024

    code-review-security has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Yuki Torres· Dec 20, 2024

    Solid pick for teams standardizing on skills: code-review-security is focused, and the summary matches what you get after install.

  • Arjun Choi· Dec 12, 2024

    Useful defaults in code-review-security — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Amina Harris· Dec 12, 2024

    code-review-security is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Layla Choi· Nov 19, 2024

    Useful defaults in code-review-security — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Yuki Flores· Nov 19, 2024

    Keeps context tight: code-review-security is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Layla Park· Nov 15, 2024

    code-review-security reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 61

1 / 7