All Questions
Api Design hard

A malicious client sends a GraphQL query with nested fragments causing exponential resolution (query bomb). How do you prevent this?

  1. A Enforce static analysis to reject queries exceeding a maximum depth threshold and implement a complexity scoring system that assigns a scalar cost to every schema field.
  2. B Adopt a trust-based policy that relies on client-side linting and developer documentation to ensure that only optimized and shallow queries are sent to the production cluster.
  3. C Implement a basic request-count rate limiter that treats all GraphQL operations as having an identical execution cost regardless of the depth or breadth of the requested fragment.
  4. D Disable the use of nested fragments and recursive object references entirely to ensure that every possible GraphQL query is strictly linear in its resolution path.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions