api-security
Guideline for designing, implementing, and verifying secure APIs following OWASP API Security Top 10 (2023) best practices. Use when the user wants to: (1) review API code or design for security vulnerabilities, (2) design a secure REST, GraphQL, or gRPC API architecture, (3) implement API authentication and authorization (OAuth2, JWT, API keys, mTLS), (4) configure rate limiting, input validation, or CORS, (5) audit API endpoints for BOLA, BFLA, or mass assignment vulnerabilities, (6) create API security checklists or verification plans, (7) fix API security bugs or harden existing APIs, (8) set up API security testing (OWASP ZAP, Schemathesis, Burp Suite), or (9) handle any API security concern including SSRF prevention, resource consumption limits, business flow protection, API inventory management, and secure third-party API consumption.
What this skill does
# API Security Development Guide Structured approach to building secure APIs, covering OWASP API Security Top 10 (2023), secure design patterns, and verification checklists. Apply these guidelines throughout the API development lifecycle — from threat modeling to deployment monitoring. ## Secure API Development Lifecycle ### Phase 1: API Threat Modeling and Design - Identify API attack surfaces: public endpoints, authenticated endpoints, admin endpoints, webhooks, third-party integrations - Map data flows: what sensitive data crosses each API boundary - Define authorization model: which users/roles access which resources and properties - Design security controls: - Centralized authentication (OAuth2/OIDC at API gateway) - Object-level authorization at data access layer - Schema-based input validation at every endpoint - Rate limiting per endpoint sensitivity - API versioning with deprecation strategy ### Phase 2: Secure Implementation #### Critical API Security Rules | Never | Instead | |-------|---------| | Return full objects (to_dict/to_json) | Explicit response schemas with cherry-picked fields | | Accept arbitrary fields for update | Allowlisted update schemas (prevent mass assignment) | | Use sequential/guessable IDs in URLs | UUIDs/GUIDs for resource identifiers | | Trust object ID alone for access | Check object ownership against authenticated user | | Rely on client-side role checks | Server-side RBAC/ABAC middleware | | Accept unlimited query params/body | Schema validation with size/type/range limits | | Skip rate limiting on any endpoint | Rate limit ALL endpoints, stricter on auth/business flows | | Return stack traces in errors | RFC 7807 Problem Details with generic messages | | Trust third-party API responses | Validate and sanitize all external API data | | Put API keys in URLs | Use Authorization header or secure key vault | | Use wildcard CORS with credentials | Explicit origin allowlist | | Allow unlimited GraphQL depth/complexity | Query depth + complexity + batch limits | Reference detailed guides: - For OWASP API Top 10 with code examples: See [references/owasp-api-top-10.md](references/owasp-api-top-10.md) - For secure API design patterns: See [references/secure-api-design.md](references/secure-api-design.md) ### Phase 3: API Security Verification 1. **Schema Validation** — Lint OpenAPI spec for security issues (Spectral) 2. **Static Analysis** — Run SAST on API code (Semgrep, bandit) 3. **Contract Testing** — Verify API behavior matches spec (Schemathesis, Dredd) 4. **Dynamic Testing** — Run DAST against running API (OWASP ZAP, Burp Suite) 5. **Authorization Testing** — Test every endpoint with wrong user/role/anonymous 6. **Rate Limit Testing** — Verify all endpoints enforce limits 7. **Code Review** — Apply API security checklists Reference: See [references/api-security-checklist.md](references/api-security-checklist.md) ### Phase 4: Deployment and Monitoring - API gateway: auth offloading, rate limiting, request logging - TLS 1.2+ enforcement, HSTS, security headers - Structured logging (no tokens/PII in logs) - Anomaly detection and alerting on security events - API inventory management and version deprecation - Incident response plan for API breaches ## OWASP API Security Top 10 (2023) Quick Reference | # | Risk | Key Concern | Primary Prevention | |---|------|------------|-------------------| | API1 | Broken Object Level Authorization | Accessing other users' resources by manipulating IDs | Object ownership check at data layer, use GUIDs | | API2 | Broken Authentication | Weak auth, credential stuffing, JWT flaws | OAuth2/OIDC, short-lived tokens, rate limit auth | | API3 | Broken Object Property Level Authorization | Excessive data exposure + mass assignment | Explicit response/request schemas, field allowlists | | API4 | Unrestricted Resource Consumption | No rate/size/cost limits, GraphQL batching | Rate limiting, pagination caps, spending alerts | | API5 | Broken Function Level Authorization | Regular users accessing admin functions | RBAC middleware, deny by default, test all roles | | API6 | Unrestricted Access to Sensitive Business Flows | Automating business-critical operations (scalping, spam) | CAPTCHA, device fingerprinting, behavior analysis | | API7 | Server Side Request Forgery | API fetches user-supplied URLs | URL allowlisting, block private IPs, disable redirects | | API8 | Security Misconfiguration | Missing headers, CORS *, verbose errors, debug endpoints | Hardened defaults, security headers, minimal errors | | API9 | Improper Inventory Management | Shadow APIs, deprecated versions, no documentation | API inventory, OpenAPI in CI/CD, retirement plans | | API10 | Unsafe Consumption of APIs | Trusting third-party API data without validation | Validate all external data, enforce TLS, set timeouts | For detailed attack scenarios and code examples: See [references/owasp-api-top-10.md](references/owasp-api-top-10.md) ## API Security Review Workflow Step-by-step procedure for reviewing API security: 1. **Map the API surface** — List all endpoints, methods, auth requirements, and data flows. Check for undocumented/shadow endpoints. 2. **Check authentication** — Verify every non-public endpoint requires valid authentication. Test with missing/expired/malformed tokens. 3. **Check object-level authorization (BOLA)** — For every endpoint accepting resource IDs, verify users can only access their own resources. 4. **Check function-level authorization (BFLA)** — Verify admin endpoints reject non-admin users. Test horizontal and vertical privilege escalation. 5. **Check property-level authorization** — Verify responses only include authorized fields. Test mass assignment by sending extra fields in updates. 6. **Validate input handling** — Check schema validation on all inputs. Test with oversized payloads, unexpected types, injection payloads. 7. **Check rate limiting** — Verify limits on all endpoints, especially auth, business-critical, and resource-intensive operations. 8. **Check error handling** — Verify no sensitive info in error responses. Test with invalid inputs, missing resources, server errors. 9. **Review third-party integrations** — Verify external API responses are validated. Check for SSRF in URL-accepting endpoints. 10. **Check API inventory** — Verify no deprecated/shadow endpoints are live. Check documentation matches reality. 11. **Report findings** — Severity (Critical/High/Medium/Low), endpoint, vulnerable request, explanation, fix with code example. ## API Security Testing Quick Commands ```bash # === OpenAPI Spec Linting === npm install -g @stoplight/spectral-cli && spectral lint openapi.yaml # === Property-based API Testing === pip install schemathesis && schemathesis run --checks all http://localhost:8000/openapi.json # === Dynamic Security Scanning === docker run -t ghcr.io/zaproxy/zaproxy:stable zap-api-scan.py -t http://target:8000/openapi.json -f openapi # === API Fuzzing === # nuclei -u http://target:8000 -t api/ # === Static Analysis (Python API) === pip install bandit && bandit -r src/ -f json pip install semgrep && semgrep --config=p/python --config=p/owasp-top-ten src/ ``` ## Reference Files - **[references/owasp-api-top-10.md](references/owasp-api-top-10.md)** — Detailed OWASP API Security Top 10 (2023) with attack scenarios, vulnerable → secure code examples for REST and GraphQL APIs - **[references/secure-api-design.md](references/secure-api-design.md)** — Secure API design patterns: authentication (OAuth2, JWT, API keys, mTLS), authorization (RBAC/ABAC), input validation, rate limiting, CORS, error handling, API gateway, monitoring - **[references/api-security-checklist.md](references/api-security-checklist.md)** — Actionable checklists for API design review, auth, input validation, transport security, rate limiting, inventory, deployment, logging, and testing
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.