Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(graphql): allow to change max_query_depth and max_query_complexity #2107

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ api_platform:

# The nesting separator used in the filter names.
nesting_separator: _


# The maximum query depth. Set to 0 to disable it. Look at http://webonyx.github.io/graphql-php/security/#limiting-query-depth
max_query_depth: 20

# The maximum query complexity. Set to 0 to disable it. Look at http://webonyx.github.io/graphql-php/security/#query-complexity-analysis
max_query_complexity: 500

collection:
pagination:
enabled: true
Expand Down
32 changes: 32 additions & 0 deletions core/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,38 @@ return [
];
```

## Change Max Query Depth

For security reason, the max query depth should be limited to avoid deep queries. It's set to 100 by default.

### Symfony config to change the Max Query Depth

If you need to change it, it can be done in the configuration:

```yaml
# api/config/packages/api_platform.yaml
api_platform:
graphql:
max_query_depth: 7
# ...
```

## Change Max Query Complexity

For security reason, the max query complexity should be limited to avoid complex queries. It's set to 100 by default.

### Symfony config to change the Max Query Complexity

If you need to change it, it can be done in the configuration:

```yaml
# api/config/packages/api_platform.yaml
api_platform:
graphql:
max_query_complexity: 50
# ...
```

## Request with `application/graphql` Content-Type

If you wish to send a [POST request using the `application/graphql` Content-Type](https://graphql.org/learn/serving-over-http/#post-request),
Expand Down
Loading