Max Aliases
Limit the number of aliases in a GraphQL document.
It is used to prevent DOS attack or heap overflow.
How to use?
Install the plugin:
npm install @escape.tech/graphql-armor-max-aliases
Then, add it to your plugins:
mesh.config.ts
import { maxAliasesPlugin } from '@escape.tech/graphql-armor-max-aliases'
import { defineConfig as defineServeConfig } from '@graphql-mesh/serve-cli'
export default defineServeConfig({
plugins: () => [
maxAliasesPlugin({
// Toggle the plugin | Default: true
enabled: true,
// Number of aliases allowed | Default: 5
maxAliases: 5,
// Do you want to propagate the rejection to the client? | default: true
propagateOnRejection: true,
// List of queries that are allowed to bypass the plugin
allowList: [],
/* Advanced options (use here on your own risk) */
// Callbacks that are ran whenever a Query is accepted
onAccept: [],
// Callbacks that are ran whenever a Query is rejected
onReject: []
})
]
})