manifest / integrations / wp-graphql-lock
WP GraphQL Lock
Query locking for wp-graphql
by Esa-Matti Suuronen, Valu Digital Oy · github.com/valu-digital/wp-graphql-lock · website
★ 25stars
59kcomposer installs
8forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/valu-digital/wp-graphql-lock/archive/refs/heads/master.zipAlso on Packagist as valu/wp-graphql-lock:
composer require valu/wp-graphql-lockFrom the readme
🔒 WP GraphQL Lock
This plugin enables query locking for [WPGraphQL][] by implementing persisted
GraphQL queries.
Persisted GraphQL queries allow a GraphQL client to optimistically send a hash
of the query instead of the full query; if the server has seen the query
before, it can satisfy the request.
Once the server knowns all the possible queries the plugin can lock it down
disallowing any unwanted queries that are possibly malicious. This can
greatly improve the server security and can even protect against unpatched
vulnerabilities in some cases.
Alternatively you can pre-generate the query IDs from your client source code
with the [GraphQL Code Generator plugin][codegen] and load the IDs with the
graphqllockloadquery filter.
In addition to enabling query locking this saves network overhead and makes
it possible to move to GET requests instead of POST. The primary benefit
of GET requests is that they can be easily cached at the edge (e.g., with
Varnish, nginx etc.).
This plugin requires WPGraphQL 0.2.0 or newer.
[codegen]: https://github.com/valu-digital/graphql-codegen-persisted-query-ids
[wpgraphql]: https://github.com/wp-graphql/wp-graphql
Compatibility
Apollo Client p
Read the full README on GitHub →