-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Resource exhaustion exploit when parsing queries #3955
Comments
👋 Apollo Server maintainer here. Going to follow along on this issue to track updates. For @IvanGoncharov 's sake it would be nice to minimize the reproduction to exclude apollo server (and add certainty that it's a |
@trevor-scheer I'll look at just testing against graphql-js this week and post an update |
I've added a minimal graphql-js example in the same repo. You can run it using The slow parsing performance is still observed here
We've also reproduced this in a real world scenario on a API and due to it's impact, I consider it a critical issue. |
It looks like (nearly) all the time is spent in |
Ran a bisect, discovered the performance degradation was 5caff03 (#3457). Raised #3958 cc: @IvanGoncharov |
Co-authored-by: AaronMoat <AaronMoat@users.noreply.github.com> Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com> Resolves #3955 (at least
Raised #3967 for 16 |
@IvanGoncharov or others on this thread. Can we please organise a release for v16? As per #3967. I would argue this issue should not be marked complete until consumers can use a fixed version of this security/performance hole, on a stable (non-beta) release channel. |
Re-posting here as advised in apollographql/apollo-server#7688. Without digging into source code I'm not exactly sure which part of graphql-js is causing this.
Issue Description
We've identified a potential resource exhaustion vector which has a significant impact on our CPU and response times. We're currently experiencing this on AS 3 however we're able to reproduce on AS 4.
We have a custom query complexity calc plugin which is intended to handle this scenario and others however it seems before we get to
didResolveOperation
event/stage, there is some processing that takes a long time.I'm assuming this is an underlying dependancy in Apollo however I'm not 100% sure so any ideas or suggestions on how we can mitigate this would be great.
Link to Reproduction
https://github.com/tadhglewis/apollo-koa-minimal
Reproduction Steps
pnpm install && pnpm start
This will take ~2.5s and increase to ~21s if you change the number of
__typename
to3000
Notes
__typename
by one it will bypass this__typename
, it can also be hit when usinghello
and I imagine introspection as wellThe text was updated successfully, but these errors were encountered: