agentleFS
pabloirracionalpabloirracional/claude-skills/skills/reviewing-code-for-security/SKILL.md

reviewing-code-for-security

Skill0 starsChanged 4 months agoMITView on GitHub

Reviews code changes for security vulnerabilities - injection risks, hardcoded secrets, insecure defaults - and demonstrates exploitability with a working proof of concept, not just a pattern match. Use whenever the user wants a security review of code, a diff, or a pull request, or asks about vulnerabilities in their code.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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:

    When flagging an issue, show the exploit path concretely (like above) rather than a generic "this could be a vulnerability" - it's the …

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “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

Reviewing code for security

Reviews code for the highest-impact vulnerability classes first, and where feasible, proves exploitability with a real test rather than just flagging a pattern.

Workflow

  1. Injection risks first - string-concatenated SQL, unsanitized input passed to eval/shell commands, or unescaped output in templates (XSS). This is the single highest-impact, most common class - see the proven example below.
  2. Hardcoded secrets - API keys, tokens, passwords, or connection strings committed directly instead of read from environment/secret storage. Flag even in test/example code, since it gets copy-pasted into production more often than expected.
  3. Insecure defaults - weak default credentials, permissive CORS (* origin on authenticated endpoints), disabled certificate validation, debug mode left on. These pass all functional tests while being insecure - functional correctness isn't security.
  4. Risky dependency usage - deserializing untrusted input, outdated packages with known CVEs if versions are visible.
  5. Prioritize findings by exploitability and blast radius, not count. One exploitable auth bypass outweighs ten style nits - the report should reflect that.

Proven example: SQL injection via string concatenation

This isn't a hypothetical - it's a real exploit run against a real (in-memory) SQLite database, in scripts/sql-injection-demo.py.

Vulnerable code:

def vulnerable_login(username, password):
    query = f"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'"
    cur = conn.execute(query)
    return cur.fetchone()

Actual result when tested with username = "admin' -- ", password = "anything":

  • The '-- closes the username string and comments out the rest of the query, including the password check entirely.
  • Confirmed output: logs in as admin, no password needed - (1, 'admin', 'sup3rsecret') returned.

Fix - parameterized query:

def safe_login(username, password):
    cur = conn.execute(
        "SELECT * FROM users WHERE username = ? AND password = ?",
        (username, password),
    )
    return cur.fetchone()

Confirmed: the identical payload against safe_login returns None - no bypass. The driver treats the input as data, never as SQL syntax, regardless of what characters it contains.

This is the standard to hold any SQL-adjacent code review to: if user input reaches a query string via f-string/concatenation/.format(), it's exploitable exactly like this, not just "technically risky."

Notes

  • This is a code-level review, not a substitute for a full security audit or penetration test on production systems handling sensitive data at scale - say so explicitly when the stakes are high.
  • When flagging an issue, show the exploit path concretely (like above) rather than a generic "this could be a vulnerability" - it's the difference between an actionable finding and a boilerplate warning.

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.