Audit API Route Handlers for Auth and Permission Leaks
Get a structured security audit of your API route handlers that evaluates tenant isolation, role-based access control, and input validation risks.
Agent prompt for Claude
Prompt
mkdir -p .agents/skills/audit-api-route-handlers-for-auth-and-permission-leaks && curl -sL "https://prompts-gpt.com/prompts/audit-api-route-handlers-for-auth-and-permission-leaks/raw" -o .agents/skills/audit-api-route-handlers-for-auth-and-permission-leaks/SKILL.md---
name: audit-api-route-handlers-for-auth-and-permission-leaks
description: "Get a structured security audit of your API route handlers that evaluates tenant isolation, role-based access control, and input validation risks."
---
# Audit API Route Handlers for Auth and Permission Leaks
Get a structured security audit of your API route handlers that evaluates tenant isolation, role-based access control, and input validation risks.
## Prompt
```
Act as a Senior Security Engineer. I will paste my API route handler code. Audit the code for auth and permission vulnerabilities. Follow these rules: 1. Evaluate every endpoint for potential cross-tenant data leaks. 2. Verify that RBAC checks occur before data fetching. 3. Check for parameter tampering risks by validating ID ownership against the session user. 4. Do not suggest generic best practices; focus on concrete code flaws. This is not legal or security compliance advice; consult a professional security auditor for production systems. Output format: A table with columns: Endpoint Path, Risk Category, Severity, and Remediation. Followed by a list of high-priority security action items.
```
## Usage Notes
Copy your API route handler file or a selection of endpoints and paste it after this prompt. Works best in Claude or Claude Code when analyzing Express, FastAPI, or Hapi routes.
Act as a Senior Security Engineer. I will paste my API route handler code. Audit the code for auth and permission vulnerabilities. Follow these rules: 1. Evaluate every endpoint for potential cross-tenant data leaks. 2. Verify that RBAC checks occur before data fetching. 3. Check for parameter tampering risks by validating ID ownership against the session user. 4. Do not suggest generic best practices; focus on concrete code flaws. This is not legal or security compliance advice; consult a professional security auditor for production systems. Output format: A table with columns: Endpoint Path, Risk Category, Severity, and Remediation. Followed by a list of high-priority security action items.Example output
Tips and common edits
Why this works
- Forces a tabular format for quick identification of security gaps.
- Specifically targets high-risk areas like cross-tenant leaks and parameter tampering.
- Requires actionable remediation steps rather than vague advice.
Copy your API route handler file or a selection of endpoints and paste it after this prompt. Works best in Claude or Claude Code when analyzing Express, FastAPI, or Hapi routes.
Common edits
- Add a specific framework name like 'FastAPI' or 'Next.js' to the prompt for more accurate syntax analysis.
- Expand the table to include a column for 'Current Code snippet' if you need the model to point to specific lines.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Audit a TypeScript API Route for Race Conditions, Auth, and N+1 Bugs
Get a severity-ranked security and performance audit of your TypeScript API route with exact line numbers, concrete exploit or failure scenarios, and minimal targeted fix diffs.
Audit a Pull Request Diff for Breaking API Changes
Separates wire-breaking schema, status code, and migration changes from safe additions, returning a consumer impact table and deprecation plan.
Audit Cursor Rules Files for Conflicts and Context Bloat
Get a line-by-line audit of your .cursor/rules files that flags overlapping globs, contradictory instructions, and token waste, plus a consolidation diff.
Compare Three Feature Architectures Against Module Boundaries
Get a scored trade-off matrix comparing three feature architectures by file touchpoints, coupling risks, and rollback cost before running Cursor Composer.
Generate OpenAPI 3.1 Specs and JSDoc from Route Handlers
Turns pasted Express, Fastify, or Next.js route handlers into valid OpenAPI 3.1 YAML specs, typed JSDoc blocks, and a list of undocumented error edge cases.
Audit AI Code Diffs for Performance Regressions
This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them.
- Evaluate Coding Agent Test Suites for False Positive Traps
- Conventional Commit and PR Description from a Diff and Ticket
- Audit Error Boundaries and Telemetry Coverage in Code
- Audit Git Diffs for Race Conditions and Shared Mutable State
- Audit PR Git Diffs for Scope Creep and Churn
- Create a Deterministic Code Review System Prompt for Cursor