unsafe-api-consumption
Skill20 starsChanged 4 months agoMITView on GitHub
Detects code that consumes third-party API responses without type validation
In this repository52 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- authentication-failuresSkill
- broken-access-controlSkill
- concurrency-correctnessSkill
- contract-reviewSkill
- cryptographic-failuresSkill
- crypto-library-misuseSkill
- csrfSkill
- exceptional-conditionsSkill
- excessive-agencySkill
- file-uploadSkill
- graphql-securitySkill
- hardcoded-secretsSkill
- header-injectionSkill
- hotspotsSkill
- injectionSkill
- insecure-designSkill
- insecure-local-storageSkill
- insecure-output-handlingSkill
- insecure-plugin-designSkill
- integrity-failuresSkill
- ipc-securitySkill
- llm-supply-chainSkill
- logging-failuresSkill
- mass-assignmentSkill
- mcp-securitySkill
- memory-api-misuseSkill
- model-dosSkill
- model-theftSkill
- multi-agent-trustSkill
- nosql-injectionSkill
- numeric-trust-boundarySkill
- oauth-implementationSkill
- open-redirectSkill
- overrelianceSkill
- path-traversalSkill
- privilege-handlingSkill
- prompt-injectionSkill
- prototype-pollutionSkill
- pr-reviewSkill
- race-conditionSkill
- rag-securitySkill
- redosSkill
- security-cleanupSkill
- security-misconfigurationSkill
- security-reviewSkill
- sensitive-disclosureSkill
- ssrfSkill
- supply-chainSkill
- threat-modelSkill
- token-smugglingSkill
- training-data-poisoningSkill
The file
Files
Unsafe API Consumption Check (API10:2023)
What this checks
Protects against blindly trusting data from third-party APIs. External API responses can be tampered with (via MITM, compromised provider, or supply-chain attack), contain unexpected types or malicious payloads, or change without notice. Treating external data as trusted leads to injection, deserialization attacks, and business logic bypass.
Vulnerable patterns
- External API response fields flowing directly into SQL, shell, template, or code-execution sinks via string interpolation
- Rendering third-party HTML or markdown without a sanitization step
- Merging unvalidated external response objects into internal models
- Following redirect URLs returned by an external API without re-validating against the same allowlist
- Calling external APIs without size limits or timeouts, allowing a partner to stream gigabytes or hang the caller
Fix immediately
Flag the vulnerable code, explain the risk, and suggest a fix establishing these properties. Translate to the HTTP client, schema library, and template engine of the audited file — use that stack's documented validation, sanitization, and redirect controls; do not import a recipe from a different stack.
- Every response is validated against an explicit schema — typed struct, schema validator, JSON Schema, protobuf message, or equivalent — before any field reaches business logic. Optional fields get defaults; unexpected fields are rejected or ignored, not silently propagated.
- External data never reaches injection sinks via string interpolation. SQL goes through parameterized queries; HTML goes through an auto-escaping template engine; shell goes through argv arrays. Validation does not exempt the sink.
- Response size is bounded and the request has a timeout. A partner API can stream gigabytes or hang forever; both eat resources and can DoS the caller.
- Redirects are not followed blindly. Either disable redirects, or re-validate each hop against the same allowlist used for the initial URL. Partner-controlled 3xx responses can redirect to SSRF targets or attacker-controlled hosts.
Verification
- Every response from an external API is validated against a schema before any field is used in queries, rendering, or business logic
- External API data never reaches SQL, shell, template, or code-execution sinks via string interpolation — only through parameterized/auto-escaping interfaces
- HTTP responses from external APIs are size-limited and the request has a timeout
- Redirects from external API responses are either disabled or re-validated at each hop against the same allowlist used for the initial URL
References
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.

