-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Replace CSRF cookie with CrossOriginProtection
#36183
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
Conversation
CrossOriginProtection
CrossOriginProtectionCrossOriginProtection
|
Test failures need investigation. I think I was quite thorough with this removal, |
|
Unexpectedly, the fix in 1eb058d worked to fix the last issue. I think there may be a underlying bug why this test is sensitive to a |
tests/integration/csrf_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use a new test for CrossOriginProtection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I would still like to add a integration test that leverages Sec-Fetch-Site to validate this protection.
"breaking" usually means end users or site admins must do something, or experience something totally different. But for this one, I think it isn't really "breaking". WDYT? And, the TODOs are not necessary (or, we shouldn't "add additional trusted origins", there is no such use case) |
Leave for a while. The current logic isn't right.
|
I think the cors handler could indicate in the request context that it had a match with a boolean flag, and then the COP handler could act on that flag and be disabled. |
|
I'm not sure your AI answer is right. Go's protection relies on So I'd lean towards having all endpoints protected, without exception. Restrictions can be relaxed later if issues are demonstrated. I will push again the full strict settings. |
See my comment above. "CrossOriginProtection" must accept (trust) that origin, if I understand correctly. |
|
I've read a bit more on these topics, these seem like good resources: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html From what I gather, these header checks alone are not recommended, but header checks combined with a SameSite cookie (lax or strict) is recommended as adequate protection. |
Co-authored-by: Lunny Xiao <[email protected]> Signed-off-by: wxiaoguang <[email protected]>
* giteaofficial/main: Fix panic when get editor config file (go-gitea#36241) Refactor compare router param parse (go-gitea#36105) [skip ci] Updated translations via Crowdin Use flatten translation keys (go-gitea#36225) Replace CSRF cookie with `CrossOriginProtection` (go-gitea#36183) Remove fomantic form module (go-gitea#36222) Fix panic in blame view when a file has only a single commit (go-gitea#36230) fix: spelling error in migrate-storage cmd utility (go-gitea#36226) # Conflicts: # templates/user/settings/security/twofa.tmpl


Removes the CSRF cookie in favor of
CrossOriginProtectionwhich relies purely on HTTP headers.Fixes: #11188
Fixes: #30333
Helps: #35107
TODOs: