-
-
Notifications
You must be signed in to change notification settings - Fork 887
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): more security : with max query depth and max query complexity #6859
base: main
Are you sure you want to change the base?
Conversation
Really important for avoid dos attack |
🤔 Hmm, the scenario "Introspect the GraphQL schema" from |
I changed the value in |
258f72b
to
940b169
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, just a few comments, thanks for this addition!
src/Laravel/config/api-platform.php
Outdated
], | ||
|
||
'url_generation_strategy' => UrlGeneratorInterface::ABS_PATH, | ||
|
||
'serializer' => [ | ||
'hydra_prefix' => false, | ||
// 'datetime_format' => \DateTimeInterface::RFC3339 | ||
] | ||
], | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this file modified but it looks like cs fixes that I should probably do in another PR. Would you be able to add the configuration at https://github.com/api-platform/core/blob/main/src/Laravel/ApiPlatformProvider.php#L1295 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, cs fixer did it :)
…o 500 Set max query depth to 200 in test AppKernel, it's required for introspection.feature
d7eb6cd
to
8862596
Compare
1ab86e4
to
ee4c125
Compare
…max query complexity
@soyuka I have some failed on behat's tests (features/hydra/docs.feature:10), but I don't know why |
On our GraphQL APi, we run GraphQL COP and it's detected some security leak.
So I tried to fix some of this like "Alias overloading" and "Field Duplication".
Webonyx has this following rules : QueryComplexity and QueryDepth. So I implemented this on Api Platform to be configurable in api_platform.yml. And setted by default to 100