spacecloud-io / space-cloud

Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
https://space-cloud.io
Apache License 2.0
3.94k stars 222 forks source link

[Feature] Create a CompiledGraphqlSource #1629

Closed YourTechBud closed 1 year ago

YourTechBud commented 1 year ago

The problem faced currently?

Security risk of autogenerated Graphql APIs

  1. Autogenerated Graphql APIs usually expose all operation which could be considered "unsafe" in several application context.
  2. Allow lists are often required to prevent exploitation of such graphql apis.
  3. Allow lists are difficult to track on the client side it is not possible to know if the query described in the client is allowed or now. We need a better way

Downsides of using Graphql over REST

  1. Difficult to implement middlewares for graphql apis
  2. Difficult to perform response caching
  3. Some might even say that writing a graphql query in the client code is ugly :P

How can we solve it?

Provide the ability to compile a graphql query into an HTTP based RPC call.

  1. Create a new source CompiledGraphqlSource
  2. This will leverage the compile functionality of the graphql provider to pre-compile a graphql query
  3. The source would then feed into the rpc provider which while generate a typed REST API for our query

If you want this feature to be implemented, give it a thumbs up reaction, so that we can determine which features are important to you. 👍