API Security
Audit API security for "$ARGUMENTS". Inventory all APIs, assess authentication and authorization mechanisms, and evaluate rate limiting, input validation, and error handling practices.
Prerequisites
Read .metapowers/security/$ARGUMENTS/00-govern.md. If this file does not exist, tell the user:
Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., /security:security-policy $ARGUMENTS), or use --skip-checks to bypass.
If --skip-checks is present in $ARGUMENTS, skip this check and log to .metapowers/security/$ARGUMENTS/skip-log.md.
Process
Inventory all APIs:
- Catalog internal APIs (service-to-service), external APIs (public-facing), and partner APIs (B2B)
- Document each API's purpose, data sensitivity, and consumer audience
- Identify API specifications (OpenAPI/Swagger, GraphQL schema, gRPC protobuf)
- Note API versioning strategy and deprecated endpoints still active
Assess authentication methods:
- Review authentication mechanism per API (OAuth 2.0, API keys, JWT, mTLS, session tokens)
- Verify token validation (signature verification, expiration checks, audience validation)
- Check API key management (generation, rotation, revocation, scoping)
- Identify unauthenticated endpoints and confirm they are intentionally public
- Evaluate OAuth 2.0 flows used (authorization code with PKCE preferred over implicit)
Review authorization checks:
- Verify authorization is enforced at every endpoint (not just at the gateway)
- Check for object-level authorization (users can only access their own resources)
- Review function-level authorization (admin endpoints restricted to admin roles)
- Assess GraphQL-specific risks (nested query depth, introspection in production)
- Look for mass assignment vulnerabilities (binding request body directly to data models)
Evaluate rate limiting:
- Verify rate limiting is configured per API and per consumer
- Check rate limit differentiation by endpoint sensitivity (login endpoints, data export)
- Review rate limit response behavior (429 status code, Retry-After header)
- Assess protection against distributed attacks (per-IP and per-account limits)
Review input validation and error handling:
- Verify request body, query parameters, and headers are validated against schema
- Check for injection risks in API parameters (SQL, NoSQL, command injection)
- Confirm error responses do not leak internal details (stack traces, database errors, internal IPs)
- Review pagination to prevent data enumeration and excessive data retrieval
Assess CORS and transport security:
- Review CORS configuration (no wildcard origins for authenticated APIs)
- Verify HTTPS-only enforcement with HSTS headers
- Check for sensitive data in URL query parameters (should be in headers or body)
- Review API gateway security configuration if applicable
Write the artifact to .metapowers/security/$ARGUMENTS/02-protect.md with heading:
API Security Audit
Include sections:
- API Inventory — all APIs with type, authentication method, and data sensitivity
- Authentication Assessment — findings per API on auth mechanism strength
- Authorization Review — object-level and function-level authorization coverage
- Rate Limiting — current configuration and gaps
- Input Validation — validation coverage and injection risks
- CORS and Transport — configuration findings
- Remediation Plan — prioritized fixes by severity
Output
The API security audit written to .metapowers/security/$ARGUMENTS/02-protect.md. Present a summary to the user highlighting:
- Total APIs inventoried by type and sensitivity
- Authentication and authorization gaps found
- Rate limiting coverage
- Top priority remediations
1---2name: api-security3description: Audit API security4---56# API Security78Audit API security for "$ARGUMENTS". Inventory all APIs, assess authentication and authorization mechanisms, and evaluate rate limiting, input validation, and error handling practices.910## Prerequisites1112Read `.metapowers/security/$ARGUMENTS/00-govern.md`. If this file does not exist, tell the user:1314> Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., `/security:security-policy $ARGUMENTS`), or use `--skip-checks` to bypass.1516If `--skip-checks` is present in $ARGUMENTS, skip this check and log to `.metapowers/security/$ARGUMENTS/skip-log.md`.1718## Process19201. **Inventory all APIs:**21 - Catalog internal APIs (service-to-service), external APIs (public-facing), and partner APIs (B2B)22 - Document each API's purpose, data sensitivity, and consumer audience23 - Identify API specifications (OpenAPI/Swagger, GraphQL schema, gRPC protobuf)24 - Note API versioning strategy and deprecated endpoints still active25262. **Assess authentication methods:**27 - Review authentication mechanism per API (OAuth 2.0, API keys, JWT, mTLS, session tokens)28 - Verify token validation (signature verification, expiration checks, audience validation)29 - Check API key management (generation, rotation, revocation, scoping)30 - Identify unauthenticated endpoints and confirm they are intentionally public31 - Evaluate OAuth 2.0 flows used (authorization code with PKCE preferred over implicit)32333. **Review authorization checks:**34 - Verify authorization is enforced at every endpoint (not just at the gateway)35 - Check for object-level authorization (users can only access their own resources)36 - Review function-level authorization (admin endpoints restricted to admin roles)37 - Assess GraphQL-specific risks (nested query depth, introspection in production)38 - Look for mass assignment vulnerabilities (binding request body directly to data models)39404. **Evaluate rate limiting:**41 - Verify rate limiting is configured per API and per consumer42 - Check rate limit differentiation by endpoint sensitivity (login endpoints, data export)43 - Review rate limit response behavior (429 status code, Retry-After header)44 - Assess protection against distributed attacks (per-IP and per-account limits)45465. **Review input validation and error handling:**47 - Verify request body, query parameters, and headers are validated against schema48 - Check for injection risks in API parameters (SQL, NoSQL, command injection)49 - Confirm error responses do not leak internal details (stack traces, database errors, internal IPs)50 - Review pagination to prevent data enumeration and excessive data retrieval51526. **Assess CORS and transport security:**53 - Review CORS configuration (no wildcard origins for authenticated APIs)54 - Verify HTTPS-only enforcement with HSTS headers55 - Check for sensitive data in URL query parameters (should be in headers or body)56 - Review API gateway security configuration if applicable57587. **Write the artifact** to `.metapowers/security/$ARGUMENTS/02-protect.md` with heading:5960 ## API Security Audit6162 Include sections:63 - **API Inventory** — all APIs with type, authentication method, and data sensitivity64 - **Authentication Assessment** — findings per API on auth mechanism strength65 - **Authorization Review** — object-level and function-level authorization coverage66 - **Rate Limiting** — current configuration and gaps67 - **Input Validation** — validation coverage and injection risks68 - **CORS and Transport** — configuration findings69 - **Remediation Plan** — prioritized fixes by severity7071## Output7273The API security audit written to `.metapowers/security/$ARGUMENTS/02-protect.md`. Present a summary to the user highlighting:74- Total APIs inventoried by type and sensitivity75- Authentication and authorization gaps found76- Rate limiting coverage77- Top priority remediations