Open beta

Skills· Official

Security audit skill for coding agents

Review code for the holes that matter: auth on every entry point, tenant isolation, secrets, injection and privileged code. Report verified, ranked findings.

When to use it. Before a release, or when a change touches sign-in, permissions, API routes, webhooks, file uploads, payments, secrets, or other people's data.

Produce a findings list a person can act on: every finding traced through the code, rated by who can exploit it, with the fix. Work through the steps in order — each one feeds the next.

Steps

  1. Set the scope. The whole codebase, or one change (git diff main...HEAD). For a change, review every entry point it adds or touches, and everything those call.

  2. List every entry point. You can't secure what you haven't enumerated. Search for:

    • HTTP handlers — Next.js app/**/route.ts and pages/api/**, Express app.get( and router.post(, Django urls.py, Rails config/routes.rb, FastAPI @app.get(
    • Server actions and form handlers ("use server")
    • Webhooks, cron jobs, queue consumers, background workers
    • Anything that runs a user-supplied command, query, template, URL, or prompt

    Write a table: entry point → who should be able to call it (anyone, signed in, a member of the record's account, an admin, internal only).

  3. For each entry point, find two checks — and where they happen.

    • Authentication: is the caller identified, and is an anonymous request rejected?
    • Authorization of the specific record: is the record the request names (/orders/:id, a projectId in the body) scoped to the caller's account? "Any signed-in user" is not enough. A lookup by id with no owner or tenant condition is the most common real bug (IDOR).

    Add a column: what the code actually checks, with file:line. Every mismatch is a finding.

  4. Follow input to anything that executes. Trace request data into:

    • SQL built by string concatenation (use parameters)
    • Shell commands (exec, spawn with shell: true) and file paths (../ traversal)
    • HTML rendered without escaping (dangerouslySetInnerHTML, v-html, a template's "safe" filter)
    • Requests to user-supplied URLs (SSRF — private addresses, localhost, 169.254.169.254)
    • AI prompts and tool calls

    Ask whose code runs, and with which secrets? A low-trust user's code or command running with production credentials is a leak even when every line looks fine.

  5. Check secrets. None in source, tests, fixtures, docs, logs, or the client bundle. Start with rg -n -i "(api[_-]?key|secret|token|password)\s*[:=]\s*['\"][^'\"]{8,}" and confirm .env* files are git-ignored. A secret that was ever committed must be rotated, not just deleted. In a Gaitro project, store values with gaitro secret set NAME and read them as env.NAME.

  6. Check what crosses a trust boundary. Content one user writes that another user's browser or agent reads — comments, shared documents, markdown, skills — can carry script or injected instructions. Render it with raw HTML escaped and links limited to http(s) and mailto; scan text that agents will read for injected instructions and invisible characters.

  7. Check revocation and the human gate. Removing a member, revoking a token, or resetting a password must end access now — live sessions and agent tokens included. Anything that moves money or changes production needs a person's decision, logged.

  8. Confirm each finding by reading the whole path. Trace from the entry point to the dangerous operation before you report it. Controls often live at the point of execution — a check missing from the handler may be enforced in the query or a shared helper. If you didn't read every step, mark the finding suspected.

Rate each finding

SeverityWho can exploit it
CriticalAnyone, without an account — data, secrets, or money exposed
HighAny signed-in user — another account's data, or a privilege escalation
MediumA low-privilege role, or unusual conditions; limited reach
LowDefense in depth and hardening

Done when

  • Every entry point is in the table with its intended caller and its actual checks
  • Every path from user input to something that executes has been traced
  • No secret is in the repository, or in its history without having been rotated
  • Every finding is confirmed by reading its whole path, or marked suspected
  • Each hole you fixed has a test that fails if it reopens

Report back

A table, most severe first: severity · finding · who can exploit it · path (file:line for each step) · a concrete attack · confirmed or suspected · fix. Then the three fixes you'd make first, in order. Don't fix silently — the person decides what to fix and when.

Lock in the fixes

Write a test for each closed hole, phrased as the rule it enforces ("a member of company A gets 403 reading company B's order"). In a Gaitro project, keep it as a project check so it runs on every change: gaitro check add "<the rule>" --run "<test command>" --keep.

Traps

  • Calling a control missing after reading one function.
  • Checking authentication and forgetting authorization of the specific record.
  • Trusting client-side checks, hidden form fields, or the Referer header.
  • Reporting a theory as a confirmed bug.

More skills