Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CSRF protection #66

Merged
merged 4 commits into from
Aug 19, 2024
Merged

Add CSRF protection #66

merged 4 commits into from
Aug 19, 2024

Conversation

Shane32
Copy link
Owner

@Shane32 Shane32 commented Aug 19, 2024

Requires CORS preflight requests by ensuring that the requests are not 'simple' - e.g. GET request or form-POST requests - or that a specific header has been added to the request.

See similar logic: https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf

The chosen default header was based on the current proposal by the GraphQL working group. See:

@Shane32 Shane32 self-assigned this Aug 19, 2024
Copy link

Coverage Report

Totals Coverage
Statements: 95.8% ( 1847 / 1928 )
Methods: 80.45% ( 284 / 353 )

@coveralls
Copy link

coveralls commented Aug 19, 2024

Pull Request Test Coverage Report for Build 10445976819

Details

  • 9 of 33 (27.27%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.6%) to 92.933%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/GraphQL.AspNetCore3/GraphQLHttpMiddlewareOptions.cs 0 2 0.0%
src/GraphQL.AspNetCore3/Errors/CsrfProtectionError.cs 0 3 0.0%
src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs 9 28 32.14%
Totals Coverage Status
Change from base Build 10445715614: -1.6%
Covered Lines: 1847
Relevant Lines: 1928

💛 - Coveralls

@Shane32 Shane32 merged commit c429beb into master Aug 19, 2024
5 checks passed
@Shane32 Shane32 deleted the add_csrf_protection branch August 19, 2024 02:23
@Shane32 Shane32 added this to the 5.3.0 milestone Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants