graphql / graphql/graphql-js

[Security] No built-in query depth/complexity limit + alias bombing DoS

Open
#4,662 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
20.3k
Forks
2.1k
Avg merge
44m
Merged PRs (30d)
6

Description

## Summary
Two related DoS vectors in the execution engine:

### 1. No query depth or complexity limit
Recursive types + deep queries cause exponential resolver amplification. No built-in depth limit exists at execution time (only MaxIntrospectionDepthRule at validation).

### 2. Alias bombing
Thousands of aliases for the same field in a single flat query bypass all depth-based defenses, multiplying resolver cost linearly.

## Suggested Fix
Add optional `maxDepth` and `maxAliases` parameters to the execution options, similar to `MaxIntrospectionDepthRule`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.