Skip to content

Outdated ApolloServer option 'schemaDirectives'

Description

The Apollo GraphQL uses the 'schemaDirectives' option, which works in ApolloServer v2 but does nothing in version >=3. Depending on what the directives are used for, this can expose authenticated endpoints, disable rate limiting, and more.

Examples

Insecure Code

js
new ApolloServer({ schemaDirectives: {...} })

Secure Code

js
Create custom directives as described in the Apollo GraphQL documentation: https://www.apollographql.com/docs/apollo-server/schema/directives/#custom-directives

Remediation

Update to custom directives in ApolloServer v3 and v4 as described in the Apollo GraphQL documentation

Rule Details

FieldValue
IDCODE-0651
CategoryWeb
SeverityHIGH
CWECWE-686
ConfidenceMEDIUM
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsapollo-server, graphql, deprecated-option
OWASPN/A

References