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

HTTP handler should not allow mutations on GET requests #317

Closed
edsrzf opened this issue Aug 25, 2018 · 1 comment
Closed

HTTP handler should not allow mutations on GET requests #317

edsrzf opened this issue Aug 25, 2018 · 1 comment

Comments

@edsrzf
Copy link
Contributor

edsrzf commented Aug 25, 2018

The HTTP handler should not allow mutations on HTTP GET requests. Or at least make it configurable. This is asking for a CSRF vulnerability.

Alternatively, don't allow running queries on GET requests at all. GitHub's GraphQL API, for example, does the standard introspection query when you send it a GET request.

@vektah
Copy link
Collaborator

vektah commented Aug 27, 2018

Yeah, I have the same concerns.

The HTTP transport is really under-specified but I think GET is part of the spec - https://graphql.org/learn/serving-over-http/

The whole handler package probably needs a refactor, but yeah get should probably be configurable at least to disable it. Maybe even defaulted off.

From https://github.com/APIs-guru/graphql-over-http

GET requests can be used for executing ONLY queries. If the values of query and operationName indicates that a non-query operation is to be executed, the server should immediately respond with an error status code, and halt execution.

So yeah, we probably should block mutations / subscriptions

edsrzf added a commit to edsrzf/gqlgen that referenced this issue Aug 28, 2018
This mitigates the risk of CSRF attacks.

Closes 99designs#317.
cgxxv pushed a commit to cgxxv/gqlgen that referenced this issue Mar 25, 2022
This mitigates the risk of CSRF attacks.

Closes 99designs#317.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants