Pluralsight: Securing a GraphQL API with Apollo 3 2020 Flashcards
1
Q
03 Implementing Cookie Authentication for Apollo Server and Client
Compare Cookie Auth and Header Auth in context of vulnerability.
A
- Cookie is vulnerable to CSRF
- Header is vulnerable to XSS
2
Q
04 Restricting Access for Types and Fields with Roles and Permissions
Where authorization can be put? (3 options)
A
- in resolvers
- in model
- using schema directives
3
Q
05 Protecting Against Large and Malicious Queries / 01 Introduction
Mention 3 threats related to using GraphQL
A
- Multiple requests withing a short time
- Deeply nested queries
- Complex queries
4
Q
05 Protecting Against Large and Malicious Queries / 04 Implementing Protection Against Query Complexity
How to protect against query complexity in Apollo Server?
A
- Install library graphql-validation-complexity
- Define cost above which query is rejected
- Use schema directive to define cost of retrieving specific fields (otherwise default one is used)