graphql-security
Installation
SKILL.md
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.
- Implement a single authorization layer beneath the GraphQL API
- Resolvers should delegate to this layer for every data access decision
- Apply the same authorization rules regardless of which query or mutation is used to reach the data
- See GraphQL.org authorization guidance
Disable Introspection
GraphQL introspection exposes your full schema, including types, queries, mutations, and subscriptions. This is valuable for attackers mapping your attack surface.