Persisted operations, also known as trusted documents, allow you to register trusted operations in the router
wgc operation push
command.
This not only saves bandwidth but can also help reduce the attack surface by allowing only safe-listed operations.
wgc
to register your operations:
mygraph
in the default
namespace (as seen in the Studio) and your client named web
(indicated by the graphql-client-name
HTTP header), using the same operation identifiers as your library when possible. If your library doesn’t generate these identifiers, Cosmo will automatically generate them.
When pushing the operations, you will see a short summary of the operations that were pushed, indicating how many were created and how many were already registered. Alternatively, the --output
flag can be used to obtain a JSON summary that can easily be processed by your tooling.
wgc operations push, see
Push.
Additionally, check the Using Persisted Operation with Federated GraphQL tutorial for a step by step guide.
Enable log_unknown
Enable safelist
Enable block_non_persisted_operations
log_unknown_operations
before enabling full blocking.
safelist
option cannot be used alongside APQ, as their functions are opposite.