-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
graphql: don't allocate greedily #27873
Conversation
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.
LGTM, will merge on green
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
I thought my issue is invalid and wont be fixed. |
@gln7 what's your issue? You can submit an issue and then refer to this PR if you think it's relevant |
I reported it to your bug bounty program on Monday, got a response that the bug is invalid. Anyway, i was glad to help. |
@gln7 Thank you for reporting! We never meant that "the bug is invalid". Indeed, it is a valid bug -- what we wanted to convey was that the bug was not in scope for a bounty, because we already consider the graphql surface to be privileged. That is: if an attacker can access the graphql endpoint, the attacker can probably somehow bring the machine down or make it consume resources to make it no longer able to keep up with the chain. Hence why I posted this bug so openly. See also the bounty rules
Sorry for not crediting you in the PR description / commit message. Now that I look closer, I see that I could have found your github-handle via the supplied gist. |
@holiman Thanks for the answer! |
Fixes a graphql-dos --------- Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
This reverts commit 8257f41.
This reverts commit 8257f41.
The graphql code greedily allocated for the response. A query such as
Would thus instantly allocate space for 4 Bn pointers, going out of memory.
With this change, it will still go out of memory, but much slower.
A more rigorous fix requires us to add limits, so that anything which returns
a list of things
is capped at some point.PSA: Graphql is not secure, it should not be exposed in untrusted environments, such as the internet. This has been said before, and apparently cannot be said too often.