Skip to main content

Max Aliases

Limit the number of aliases in a GraphQL document.

It is used to prevent DOS attack or heap overflow.

Configuring for GraphQL Armor

maxAliases: {
// Toogle the plugin | default: true
enabled?: boolean,

// Aliases threshold | default: 15
n?: int,

// Callbacks that are ran whenever a Query is accepted
onAccept?: GraphQLArmorAcceptCallback[],

// Callbacks that are ran whenever a Query is rejected
onReject?: GraphQLArmorRejectCallback[],

// Do you want to propagate the rejection to the client? | default: true
propagateOnRejection?: boolean,

Standalone usage



If you want to use the maxAliases plugin out of GraphQL Armor, you can install it from npm:

# npm
npm install

# yarn
yarn add

With @graphql/graphql-js

import { maxAliasesRule } from '';

With @envelop/core from @the-guild-org

import { envelop } from '@envelop/core';
import { maxAliasesPlugin } from '';

const getEnveloped = envelop({
plugins: [
// ... other plugins ...
n: 15, // Number of aliases allowed | Default: 15