Graphql security

From RedHatProductSecurity/prodsec-skills · View interactive version

Graphql security is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Secure GraphQL API deployments against introspection leaks, deep query abuse, and authorization bypass. Use when building, reviewing, or auditing GraphQL schemas, resolvers, or gateway configurations.

How to use this skill

Skill file

GraphQL Security

GraphQL APIs introduce a threat surface distinct from REST. The flexible query language enables clients to request arbitrary data shapes, which can be abused for data exfiltration, denial of service, and authorization bypass if not constrained.

Authorization

Authorization logic MUST live in the business-logic layer, not in individual resolvers.

Scattering authorization checks across resolvers creates gaps as the schema grows. Any resolver that forgets a check becomes an exploitable authorization flaw.

Disable Introspection

GraphQL introspection exposes your full schema, including types, queries, mutations, and subscriptions. This is valuable for attackers mapping your attack surface.

Depth Limiting

Deeply nested queries can trigger expensive recursive resolution, leading to resource exhaustion.

Query Cost Analysis

Even within depth limits, queries can request expensive combinations of fields and connections.

Rate Limiting

GraphQL's single-endpoint design concentrates all operations on one URL, making rate limiting essential.

Implementation Checklist

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.