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

dont require csrf for post requests that have no cookies AND no HTTP authentication #76

Closed
komuw opened this issue Jul 6, 2022 · 1 comment · Fixed by #77
Closed

Comments

@komuw
Copy link
Owner

komuw commented Jul 6, 2022

Browsers send cookies along with all requests. CSRF attacks depend upon this behavior. If you have no cookies and no http authentication, you dont need csrf protection.

you do not need to implement CSRF counter-measures on your resource server, if you are not using cookies (sessions) and you are not using basic authentication within the browser.

http authentication

@komuw
Copy link
Owner Author

komuw commented Jul 6, 2022

if request.hasNoCookies() && 
   request.hasNoHttpAuthenticationHeaders() && 
   request.hasNoHttpForm(both application/x-www-form-urlencoded or multipart/form-data) {
    
       // exempt from csrf
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant