Unsafe api consumption

From thejefflarson/soundcheck · View interactive version

Unsafe api consumption is an AI agent skill from the GitHub repository thejefflarson/soundcheck. Detects code that consumes third-party API responses without type validation or sanitization. Use when writing code that calls third-party APIs, parses responses from external services, or integrates with webhooks and callbacks from external systems. Also invoke when deserializing or acting on data

How to use this skill

Skill file

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

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.