Graphql security

From thejefflarson/soundcheck · View interactive version

Graphql security is an AI agent skill from the GitHub repository thejefflarson/soundcheck. Detects GraphQL schemas without depth limits, cost analysis, or introspection controls. Use when writing GraphQL schemas, resolvers, or server configuration. Also invoke when setting up Apollo Server, graphql-yoga, Strawberry, gqlgen, or any GraphQL framework without explicit depth limiting, cost an

How to use this skill

Skill file

GraphQL Security Check (CWE-400)

What this checks

Protects against GraphQL-specific attack vectors: unbounded query depth that causes

exponential resolver execution, introspection left enabled in production (exposing

the full schema to attackers), and batch/alias attacks that bypass rate limiting.

Vulnerable patterns

Fix immediately

Flag the vulnerable code and explain the risk. Translate the principles below to the

language and framework of the audited file — use that stack's documented validation

rule, plugin, or middleware API; do not roll your own.

For each finding, establish these properties:

  1. Query depth is capped at a small fixed value (typically 5–10) by a

validation rule or middleware that runs before resolver execution. Unbounded

depth lets a single query trigger exponential resolver work.

  1. Total query cost is bounded. Either a cost-analysis layer that assigns

weights to fields and rejects over-budget queries, or alias/field-count limits

— the goal is that a single request cannot do unbounded work regardless of

depth. Alias batching bypasses per-request rate limits unless this is enforced.

  1. Introspection is disabled in production. Leaving it on exposes the full

schema — including deprecated fields, admin types, and hints for targeted

attacks — to anyone who can hit the endpoint. Gate it on an environment flag.

  1. **Every credential-accepting mutation (login, passwordReset, mfaVerify) has

a rate limit that survives alias batching** — apply per operation, not per

HTTP request, so a thousand aliased login selections count as a thousand

attempts.

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.