I read a lot around:
- https://github.com/pillarjs/understanding-csrf
- https://security.stackexchange.com/questions/10227/csrf-with-json-post
- Are JSON web services vulnerable to CSRF attacks?
- (Nothing on the ApolloServer site: https://www.apollographql.com/docs/apollo-server/)
However, I am not yet able to understand if our endpoint ("/graphql") is protected for this type of attack or if it is necessary to protect it with solutions like this: https://github.com/expressjs/csurf.
The thing that is not clear to me is that here: https://github.com/pillarjs/understanding-csrf they say:
When you're using CSRF tokens incorrectly: ... Adding them to JSON AJAX calls As noted above, if you do not support CORS and your APIs are strictly JSON, there is absolutely no point in adding CSRF tokens to your AJAX calls.
If we restrict our endpoint to just use Content-Type: application/json
are we safe?