---
name: api-security-assessment
description: Use when assessing API access controls and exposure.
---

# API Security Assessment

## Scope and safety
- Confirm the authorized target, accounts, request methods, rate limits, and whether response bodies or persistence are permitted. Prefer controlled test tenants and known resources. Avoid destructive requests unless explicitly authorized.
- Inspect supplied scripts before running: identify target hosts, credentials, request methods, redirects, response reads, output files and overwrite behavior. Do not assume comments accurately describe behavior. Avoid printing credentials or sensitive bodies.
- Disable automatic cross-origin redirects for authenticated requests, or explicitly validate each redirect before forwarding credentials. A redirect check without credentials does not establish authenticated redirect behavior.
- Status-only checks can still read response bytes into memory, and `Content-Length` is a declared header, not necessarily the bytes received. Describe these distinctions accurately.

## Access-control workflow
1. Compare unauthenticated requests, a low-privilege account, and where authorized a privileged control, using known existing resources from separate test tenants. Record methods, paths, identity classes and status codes without recording tokens or response bodies.
2. Treat 401/403 as denied for the tested request; 404 alone does not prove a cross-tenant boundary unless resource existence and ownership are independently confirmed. A 400 or 405 is not proof of authorization behavior.
3. For scoped query parameters, compare known own and known foreign IDs with a positive control and the documented parameter semantics. A 200 for a foreign ID merits investigation but does not alone prove a leak: an endpoint may ignore the parameter or return a global catalog. Identical Content-Length values do not establish identical response content; avoid inspecting bodies unless authorized.
4. For proxy-header tests compare baseline and spoofed `X-Forwarded-For` / `X-Real-IP` responses on authorized test routes. Matching status codes only establish that the tested statuses did not change, not that the backend never trusts those headers.
4. Distinguish exposed observability endpoints from vulnerabilities: assess network exposure, sensitivity and intended policy before concluding. A GET route sweep is not a complete API inventory or a test of other methods.
5. Report exact observed outcomes, request coverage, controls and limitations; include complete sanitized output when requested. Never disclose secrets, even if they appear unexpectedly in a tool result.
