# Security Focused

> Review a diff for injection, auth, secrets, and unsafe deserialization issues.

- Skill: `aletheore/security-focused` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add aletheore/security-focused`
- Raw SKILL.md: https://api.skillmd.com/api/skills/aletheore/security-focused/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- License: MIT
- Author: aletheore (https://skillmd.com/u/aletheore)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/aletheore/security-focused

---


# Security-Focused Code Review

Adapted from the `review-security` skill in [borkweb/skills](https://github.com/borkweb/skills)
(MIT License, Copyright (c) 2025 Matthew Batchelder). The original is a large
reference library of twenty evidence-based pattern files grounded in real CVEs
from the Linux kernel, OpenSSL, Chromium, curl, Go, Rust, and other major
open-source projects; this skill condenses its workflow and severity model
into a single self-contained pass over four high-frequency categories:
**injection, authentication/authorization, secrets, and unsafe deserialization**.

## Step 1: Pin the scope

Before looking for anything, know exactly what you are reviewing:
- Record the base and head commits (or the exact diff/file list) you are reviewing.
- If the scope changes mid-review (new commits land, files are added), re-pin
  and note that the earlier findings were against an older snapshot.
- Prefer reviewing `git diff <base>...<head>`, not just the files touched —
  a one-line change to a validation function can matter more than the diff
  around it suggests, so trace callers when a changed function is
  security-relevant.

## Step 2: Walk each category against the diff

Do not scan impressionistically. For each changed file, ask the four
questions below in order, and cite `file:line` for every finding — "looks
fine" without a line reference is not a finding and not a clearance.

### Injection
**Core question:** does any string built from user-controlled input reach an
interpreter (SQL, shell, template engine, HTML renderer, regex engine,
deserializer, ORM `.raw()`/`.extra()` call) without passing through a
parameterized API or an escaping function designed for that exact sink?
- Check: SQL built with f-strings/concatenation instead of parameterized
  queries or an ORM's bound-parameter methods.
- Check: shell commands built with string interpolation (`subprocess.run(cmd,
  shell=True)` with an f-string) instead of an argument list.
- Check: HTML/JS built by string-concatenating user input instead of using
  the templating engine's auto-escaping, or `innerHTML`/`dangerouslySetInnerHTML`
  fed from a request body.
- Red flag: any `f"...{user_input}..."` or `+` string-building that is then
  passed to `execute()`, `eval()`, `exec()`, `os.system()`, or a template
  renderer with autoescape disabled.

### Authentication & authorization
**Core question:** for this new or changed endpoint/handler, what proves the
caller is who they claim to be, and what proves they are allowed to do this
specific action on this specific resource (not just "logged in")?
- Check: every new route/handler has an explicit auth check, not an inherited
  one you're assuming from a decorator applied two files away — confirm it.
- Check: object-level authorization ("IDOR") — does the handler verify the
  authenticated user owns/can-access the specific `id` in the request, or
  does it trust any ID a caller supplies?
- Check: session/token validation happens before any side-effecting work, not
  after, and failure paths deny by default rather than falling through.
- Red flag: a new `/admin/*` or resource-mutating route with no visible
  permission check in the diff, or an authorization check that compares
  against a value also supplied by the client.

### Secrets
**Core question:** could this change cause a credential, API key, token, or
private key to be written somewhere it can leak — source control, logs,
error messages, or a client-visible response?
- Check: no literal API keys, passwords, or tokens added to source, config
  committed to the repo, test fixtures, or example files.
- Check: logging statements and exception messages don't include
  full request/response bodies, headers (`Authorization`, `Cookie`), or
  config objects that may contain secrets.
- Check: new config/env var plumbing reads secrets from environment or a
  secret manager, not from a hardcoded default used as a fallback.
- Red flag: `password=`, `api_key=`, `secret=`, `token=` followed by a quoted
  literal in a diff; `print(request)` or `logger.debug(config)` style logging
  of whole objects.

### Unsafe deserialization
**Core question:** does this change deserialize data from an untrusted
source (network request, uploaded file, queue message, cache) using a format
or library that can execute code or construct arbitrary objects as a side
effect of parsing?
- Check: Python `pickle.loads`/`yaml.load` (without `SafeLoader`) on anything
  that isn't fully trusted and generated by your own process.
- Check: Java/`.NET` native (de)serialization of attacker-reachable byte
  streams instead of a safe, schema-constrained format (JSON with a strict
  schema, protobuf).
- Check: JS `eval()`/`Function()` or Node's `vm` module on configuration or
  request data instead of `JSON.parse`.
- Red flag: any new call to a format-agnostic "load arbitrary object graph"
  deserializer fed directly from a request body, upload, or queue payload.

## Step 3: Record findings with a severity

For every finding, use this shape so a reviewer or author can act on it
without re-deriving the reasoning:

```
[SEVERITY] category file:line
  Problem: <1-2 lines, what's wrong>
  Evidence: <the pattern matched, e.g. "string-built SQL reaches execute()">
  Fix: <concrete, specific suggestion>
```

Severity:
- **CRITICAL** — remotely exploitable without authentication, or leads to
  RCE, auth bypass, or data exfiltration.
- **HIGH** — exploitable by an authenticated user beyond their own data/scope.
- **INFORMATIONAL** — a real gap, but not currently reachable, or a hygiene
  issue (e.g. a secret-shaped literal that turns out to be a test fixture
  already rotated out of use).

## Step 4: Verdict

Close every review with one of:
- **PASS** — no CRITICAL/HIGH findings.
- **PASS WITH REMEDIATIONS** — CRITICAL/HIGH findings existed and were fixed
  and re-verified before merge.
- **FAIL** — unresolved CRITICAL/HIGH findings; list each with what's needed
  to close it. Do not merge.

Never write "looks fine overall" as a substitute for walking the four
categories explicitly — the point of this skill is that each category gets
its own deliberate pass, not a single impression of the diff.

