/meta-reviewing-api-reviewing:meta-reviewing-api-reviewingfrom meta-reviewing-api-reviewing
Reviews backend diffs for injection, SSRF, authorization, mass assignment, data exposure, error leakage, and unbounded queries. Activates when a diff touches API routes, handlers, database access, auth middleware, or server code reading files or fetching URLs.
Ships in meta-reviewing-api-reviewing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Quick Guide: Review a backend diff's inputs and outputs before anything else in it: what enters without a schema, what reaches an interpreter or an outbound request as part of a string, which route answers without checking whose row it returns, and which fields leave in a response, a log or an error. Those are Must Fix and block approval; error text and query shape are Should Fix, addressed before merge without blocking it; the rest of the codebase's habits are not this diff's findings. Two facts change the verdict often enough to hold up front: a tagged
sqltemplate binds its interpolated values, so the injection is the untagged template literal; and an argument array keeps the shell out but not the program's own option parser.
Detailed Resources:
<critical_requirements>
Follow every value the diff reads from a request — body, params, query, headers, cookies — to the line that uses it. The defect lives at the use: a handler that parses its body and then reads limit raw from the query string is unvalidated exactly where it matters.
Treat request data reaching SQL, a shell, a file path or an outbound URL as Must Fix unless it arrives as a bound parameter, an argument-array element that cannot start with -, a path confirmed inside its base directory, or an allowlisted value. Spliced into a string something else parses, data becomes instructions, and nothing downstream can tell the two apart.
For every route the diff adds or changes, find the guard that authenticates the caller and the condition that ties the row to them. Authentication says who is asking; without the ownership condition, changing the id in the URL returns someone else's row.
Read each response body, write, log line and error message the diff adds field by field. A serialized row carries every column, a write bound to the request body accepts every column, and a logged request carries its credentials to everyone who reads the logs.
</critical_requirements>
Auto-detection: API review, backend PR review, endpoint review, route handler review, SQL injection, command injection, argument injection, path traversal, SSRF, IDOR, BOLA, broken object level authorization, mass assignment, excessive data exposure, error leakage, secrets in logs, N+1 query, unbounded query
Applies to:
Handled elsewhere:
A UI defect reaches the user who triggers it; a server defect reaches every row the server can read. So a backend diff's inputs and outputs are reviewed before its structure, and each route gets two questions asked separately — who may call this, and may they touch this row — because the second is the one that goes missing. Error paths get the same reading as the happy path: what a failure returns is part of the contract, and it is where internals leak.
<decision_framework>
Does request data reach an interpreter, an outbound request, or another user's data —
or can a failure escape the error handler?
├─ Spliced into SQL, a shell command, a file path or a fetched URL → Must Fix
├─ A route with no guard, or a query with no ownership condition → Must Fix
├─ A write bound to the request body rather than to named fields → Must Fix
├─ Secrets, tokens or personal data in a response, a log line or source → Must Fix
├─ Request data used with no schema at the boundary → Must Fix
├─ A promise the handler neither awaits, returns nor gives its own .catch → Must Fix
│ (a task detached on purpose with its own .catch, or through the
│ codebase's documented fire-and-forget helper, is fine)
└─ NO → Does it fail under real input or real volume?
├─ Stack, SQL or driver text in a client-facing error → Should Fix
├─ A query per row in a loop over records that grow with usage → Should Fix
├─ A list endpoint with no bound on a growing table → Should Fix
├─ Writes that must land together, outside a transaction → Should Fix
├─ A status that contradicts the failure (200 wrapping an error, 500 for bad input) → Should Fix
└─ NO → Is it an improvement the diff's purpose supports?
├─ Narrowing a schema that is already safe → Nice to Have
└─ Rate limits, caching, a repository layer, an index on a table that stays small → don't write it
A performance finding names the workload that makes it real: a query per row over a user's orders grows with every order, and a missing index on a twelve-row lookup table never will.
</decision_framework>
Nothing that parses — the database, a shell, a program's option parser, the filesystem, an HTTP client — receives request data as part of its instructions.
sql template. An untagged template literal or + produces one string, and the database parses all of it.raw, unsafe or literal receive no request data; they hand their string to the database verbatim, by design.shell: true. A request value in that array is refused if it starts with -, or placed after -- where the program honours it.../ misses encoded and nested forms.// Must Fix: the search term is parsed as SQL
await db.query(`SELECT id FROM posts WHERE title = '${query.q}'`);
// Bound: the value travels separately from the statement
await db.query("SELECT id FROM posts WHERE title = $1", [query.q]);
await sql`SELECT id FROM posts WHERE title = ${query.q}`;
Full code: examples/core.md
Every value the handler uses has passed a schema, and the handler reads what the schema returned.
limit with no maximum turns a list endpoint into a full-table read.// Must Fix: "abc" becomes NaN, and nothing caps the page size
const items = await listItems(Number(query.limit));
// The handler reads the parsed output: an integer from 1 to 100
const { limit } = listQuerySchema.parse(query);
const items = await listItems(limit);
Full code: examples/core.md
Who may call this, and may they touch this row. OWASP's API Security Top 10 (2023) ranks broken object-level authorization first.
// Must Fix: any signed-in user reads any invoice by changing the id
await db.query("SELECT id, total FROM invoices WHERE id = $1", [params.id]);
// Ownership is part of the query
await db.query(
"SELECT id, total FROM invoices WHERE id = $1 AND owner_id = $2",
[params.id, session.userId],
);
Full code: examples/core.md
Fields leave and enter by name. OWASP's API3:2023 merges excessive data exposure and mass assignment into one category, because both are an entity's shape crossing the boundary unfiltered.
role, ownerId or verified. Where the body passed a schema, check its unknown-key mode: some libraries strip undeclared keys by default, some keep them, and every loose or passthrough mode keeps them.process.env reads in handlers. A direct read skips whatever validation the module does, so a missing or malformed value surfaces as a failed request rather than a failed start.// Must Fix: sending { "role": "admin" } promotes the caller
await users.update(session.userId, body);
// The write names what a user may change
const { name, email } = profileSchema.parse(body);
await users.update(session.userId, { name, email });
Full code: examples/core.md
What a failure returns is part of the contract.
.catch; one that is none of these is Must Fix. The framework's error handler never sees its rejection, so the client gets no error response, and under Node's default --unhandled-rejections=throw (since v15) the rejection becomes an uncaught exception that ends the process. A task detached on purpose — with its own .catch, or through the codebase's documented fire-and-forget helper — is fine.// Should Fix: dialect, table names and stack frames reach the client
return { status: 500, body: { error: String(error) } };
// The log gets the detail; the client gets a message written for it
logServerError("signup failed", error);
return { status: 500, body: { error: "Could not create account" } };
Full code: examples/core.md
Read the data access at production volume; seed data hides every one of these.
// Should Fix: one round trip per order
for (const order of orders) {
order.items = await db.query(
"SELECT sku, quantity FROM order_items WHERE order_id = $1",
[order.id],
);
}
Full code: examples/core.md
<red_flags>
Grep the diff for these, then read each hit against its pattern:
+ around SELECT, INSERT, UPDATE, DELETE or WHERE (Pattern 1)raw, unsafe or literal (Pattern 1)exec(, execSync( and shell: true (Pattern 1)readFile, createReadStream, unlink or path.join given request data (Pattern 1)fetch( or another HTTP client given a URL from the request (Pattern 1)String(error), error.message or .stack in a response body (Pattern 5)await, return or .catch in a handler — Must Fix; a detached task with its own .catch, or the codebase's documented fire-and-forget helper, is fine (Pattern 5)await inside a for over the results of another query (Pattern 6)Looks safe, isn't:
--upload-pack=… as an option when the request value starts with -. Refuse option-shaped values, or put -- before the positionals.resolved.startsWith(base) — with no trailing separator it also admits the sibling directory uploads-old.Looks unsafe, isn't:
sql template interpolating a request value — the tag binds it as a parameter. The same text with no tag in front is the injection.</red_flags>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
api-review, backend-security, code-review, injection, authorization
npx claudepluginhub agents-inc/skills --plugin meta-reviewing-api-reviewingOther plugins' skills for the same job