icgc-argo / icgc-argo/platform-api

Gateway query complexity analysis

Open
#53 1 comment 0 reactions 1 assignee View on GitHub

@hlminh2000 is already working on this.

Since Jun 15, 2019.

Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
9h 6m
Merged PRs (30d)
3

Description

We need to apply complexity limits to our gateway layer to prevent executions of malicious queries.

The problem:
Some Graphql queries can be very expensive to resolve in three ways:

  • The query is highly nested (imagine the "small world" problem of every person being separated only by 5 connections away)
  • The query requests too many objects (imagine if a single query requests 1000 individual programs by id)
  • The query causes unnecessary calls to upstream services for the same data

Because of this, traditional rate-limits alone will not protect our system from DOS attacks, as a single expensive query has the ability to put heavy strain on the system.

The solution:

Applying complexity analysis on the queries prevents expensive queries from being executed at all before it reaches our resolvers.

We'll start with arbitrary depth and complexity limits, then log out the metrics to see what our normal usage is like, then can adjust later in production to better reflect real-world requirements. It's more important to have the gateway set up for it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.