api-security
Skill3 starsChanged 8 months agoMITView on GitHub
OWASP API Security Top 10 (2023) with production Next.js App Router code — access control, authentication, input validation, rate limiting, security headers, data exposure, supply chain, SSRF
- Reads credentials
24 other projects use a version of this.
Adopted by
Most recently taken up by
- z91772524-ai/pojia-next-mactheir own version, first seen Sep 28, 2026
- jim60105/copilot-prompttheir own version, first seen Sep 28, 2026
- zhaoxuya520/reverse-skilltheir own version, first seen Sep 22, 2026
- awarexone/AXguardtheir own version, first seen Sep 15, 2026
- 1398281322-a11y/java-backend-guardrailstheir own version, first seen Aug 31, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
Used with
Projects with it also use src-hunter, database-security and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xAmirHamza77Skillsrc-hunter
实战 SRC / 众测 / Bug bounty vulnerability挖掘工作流 skill。包含:5 phasemethodology(intake → recon → enum → hunt → report)、19 个攻击类 playbook(SQLi/XSS/RCE/SSRF/IDOR/CSRF/Path Traversal/File Upload/SSTI/XXE/Race/HTTP Smuggling/OAuth/JWT/SAML/GraphQL/Mobile/LLM/DoS)、305 个结构化 payload、263 个 WAF/EDR bypass变体、2887 份 HackerOne 真实 High/Critical 已披露案例、77,000+ WooYun 案例统计、国产 OA / 中间件指纹库、银行 / 电信行业垂直 playbook。当用户提到 "src 挖洞 / src vulnerability挖掘 / bug bounty / 众测 / hackerone / vulnerability赏金 / SRC / 任意 X vulnerability / penetration testing" 或问"如何挖某个target / 怎么测某个 API / 如何bypass WAF" 时触发。
Also in 5 projects that use this
JeremyMorganSkilldatabase-security
Examines all database interactions for injection, access control, encryption, and data-exposure risks. Use when auditing database and data-layer security.
Also in 5 projects that use this
xAmirHamza77Skillattack-chain
Use for authorized multi-stage attack-path planning and orchestration when a task spans reconnaissance, initial access, privilege escalation, lateral movement, or impact assessment. Route single-stage tasks directly to their specialist skill.
Also in 4 projects that use this
- +9 more from xAmirHamza77
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- zhaoxuya520/reverse-skill★ 40ksame name
- transilienceai/communitytools★ 555same name
- hardw00t/ai-security-arsenal★ 104same name
- UnitOneAI/SecuritySkills★ 78same name
- jefflester/claude-skills-supercharged★ 42same name
- ShieldNet-360/secure-vibe★ 22same name
- ShulkwiSEC/bb-huge★ 22same name
- jim60105/copilot-prompt★ 21same name
- GoldenWing-360/claude-security-skills★ 19same name
- awarexone/AXguard★ 18same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- nextjs-app-routerSkill
- product-marketingSkill
- react-performanceSkill
- seoSkill
- ux-copySkill
- wcag-accessibilitySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 82
Every exported 'use server' function is reachable via direct POST request.
- Very specific: line 151
When reviewing API code in Next.js, verify:
“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Security — OWASP API Security Top 10 (2023) for Next.js
Production-grade API security patterns for Next.js App Router. Covers every category in the OWASP API Security Top 10 (2023) with cross-references to the OWASP Web Top 10 (2021). Verified against the official OWASP specifications.
Architecture
Request → proxy.ts (auth gate) → Route Handler / Server Action
↓
Input Validation (Zod)
↓
Data Access Layer (auth + authz + DTO)
↓
Database (parameterized queries)
↓
Filtered Response (DTO, no raw records)The Data Access Layer (DAL) is the central security architecture recommended by Next.js. All database access, authorization checks, and response filtering happen in one server-only module — never in components or actions directly.
Quick Reference
| Resource | OWASP API | OWASP Web | What It Covers |
| Access Control | API1, API5 | A01 | BOLA/IDOR, function-level auth, ownership checks |
| Authentication | API2 | A07, A02 | Session management, JWT, Clerk/Auth0, proxy.ts |
| Input Validation | API3, API8 | A03 | Zod schemas, SQL injection, XSS, Server Action validation |
| Rate Limiting | API4 | A04 | Per-endpoint limits, cost attacks, Upstash patterns |
| Security Headers | API8 | A05 | CSP, HSTS, CORS, Permissions-Policy, next.config |
| Data Exposure | API3, API6 | A04 | DAL pattern, DTOs, error sanitization, response filtering |
| Supply Chain | API9, API10 | A06, A08 | Dependencies, env vars, CI/CD, third-party APIs |
| SSRF & Logging | API7 | A09, A10 | URL validation, fetch safety, secure logging, audit trails |
Decision Matrix: "Where Do I Add Security?"
| Layer | What to Check | Why |
proxy.ts | Auth redirect, CSP nonce, rate limit headers | First line — blocks unauthenticated requests early |
Route Handler (route.ts) | Auth + authz, input validation, CORS, CSRF | Public HTTP endpoint — treat as untrusted |
Server Action ('use server') | Auth + authz, input validation, return filtering | Also a public HTTP endpoint — not protected by the UI |
Data Access Layer (data/*.ts) | Ownership checks, field filtering, parameterized queries | Last line — defense in depth |
next.config.ts | Security headers, redirects, allowed image domains | Static security baseline |
The #1 Mistake: Server Actions Are Public Endpoints
Every exported 'use server' function is reachable via direct POST request. Page-level auth does NOT protect actions on that page.
// FAIL — no auth check, anyone can call this via POST
'use server'
export async function deleteAccount(userId: string) {
await db.delete(users).where(eq(users.id, userId))
}
// PASS — validates auth AND ownership inside the action
'use server'
import { getCurrentUser } from '@/data/auth'
export async function deleteAccount() {
const user = await getCurrentUser()
if (!user) throw new Error('Unauthorized')
await db.delete(users).where(eq(users.id, user.id))
}Notice: the PASS version doesn't accept userId as a parameter — it derives it from the session. This prevents IDOR (Insecure Direct Object Reference).
Decision Matrix: "Is This Secure?"
| Question | If No → | Resource |
| Does every Server Action re-verify auth? | Add getCurrentUser() check | Access Control |
| Does every Route Handler validate input with Zod? | Add schema validation | Input Validation |
| Are database queries parameterized? | Use tagged templates or ORM | Input Validation |
| Does the response return only needed fields? | Add DTO layer | Data Exposure |
| Are rate limits in place for auth endpoints? | Add Upstash/Arcjet | Rate Limiting |
| Are security headers configured? | Add to next.config.ts | Security Headers |
Is proxy.ts checking auth before page access? | Add auth middleware | Authentication |
| Are env vars only accessed in the DAL? | Move to server-only module | Supply Chain |
Does fetch() in server code validate URLs? | Add URL allowlist | SSRF & Logging |
| Are errors sanitized before returning to client? | Return generic messages | Data Exposure |
OWASP API Security Top 10 (2023) — Full Mapping
| # | Category | Severity | Resource |
| API1 | Broken Object Level Authorization (BOLA) | Critical | access-control |
| API2 | Broken Authentication | Critical | authentication |
| API3 | Broken Object Property Level Authorization | High | input-validation, data-exposure |
| API4 | Unrestricted Resource Consumption | High | rate-limiting |
| API5 | Broken Function Level Authorization | Critical | access-control |
| API6 | Unrestricted Access to Sensitive Business Flows | Medium | data-exposure |
| API7 | Server Side Request Forgery | High | ssrf-and-logging |
| API8 | Security Misconfiguration | Medium | security-headers, input-validation |
| API9 | Improper Inventory Management | Medium | supply-chain |
| API10 | Unsafe Consumption of APIs | Medium | supply-chain |
OWASP Web Top 10 (2021) — Cross-Reference
| # | Category | Mapped To |
| A01 | Broken Access Control | access-control |
| A02 | Cryptographic Failures | authentication |
| A03 | Injection | input-validation |
| A04 | Insecure Design | rate-limiting, data-exposure |
| A05 | Security Misconfiguration | security-headers |
| A06 | Vulnerable & Outdated Components | supply-chain |
| A07 | Auth Failures | authentication |
| A08 | Software & Data Integrity Failures | supply-chain |
| A09 | Logging & Monitoring Failures | ssrf-and-logging |
| A10 | SSRF | ssrf-and-logging |
Code Review Checklist
When reviewing API code in Next.js, verify:
- Every
'use server'function checks auth — no exceptions - No user-supplied IDs used for ownership — derive from session
- All inputs validated with Zod before use
- Database queries use parameterized queries or ORM
- Responses return DTOs, not raw database records
- Error messages don't leak stack traces, SQL, or internal paths
- Security headers set in
next.config.ts(CSP, HSTS, X-Frame-Options) - Rate limiting on auth endpoints and expensive operations
proxy.tsgates auth before page/action access- Environment variables accessed only in
server-onlymodules - No
fetch()to user-controlled URLs without allowlist - Dependencies audited — no known vulnerabilities
.env*.localin.gitignore
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
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.

