-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add cache: "bounded"
and persistedQueries: false
to default Apollo Server config
#7888
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 285a620 The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 285a620:
|
This PR changes the default of
cache
in Apollo Server to"bounded"
to ensure that an attacker cannot fill Apollo's automatic persisted queries cache to the point of memory exhaustion. This will be default in a future version of Apollo Server: https://www.apollographql.com/docs/apollo-server/performance/cache-backends#ensuring-a-bounded-cache.This also sets
persistedQueries: false
. While settingcache: "bounded"
ensures that an attacker cannot exhaust a server's memory, an attacker could still send a large number of different queries constantly to fill up the cache rendering automatic persisted queries pointless and actually degrade performance because trusted actors would have to frequently send a second request since the server would have replaced the queries from trusted actors in the cache with malicious queries and the client would have to send the actual query text in a second request. A safer and more predictable approach would be to persist queries at compile time from the actual applications the server is meant to serve such as what Relay suggests.If you're aware of the above caveats of persisted queries, you can re-enable persisted queries with
config.graphql.apolloConfig
.