Skip to content

CSRF Protection Disabled in Apollo GraphQL Server

Description

The Apollo GraphQL server has CSRF protection disabled by setting the 'csrfPrevention' option to false, making it vulnerable to Cross-Site Request Forgery (CSRF) attacks.

Examples

Insecure Code

js
new ApolloServer({ csrfPrevention: false })

Secure Code

js
new ApolloServer({ csrfPrevention: true })

Remediation

Enable CSRF protection by setting 'csrfPrevention' to true.

Rule Details

FieldValue
IDCODE-0210
CategoryWeb
SeverityHIGH
CWECWE-352
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityEASY
Tagscsrf, apollo-graphql
OWASPN/A

References