-
Notifications
You must be signed in to change notification settings - Fork 6
CSRF Protection Added #24
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
base: main
Are you sure you want to change the base?
CSRF Protection Added #24
Conversation
Sharath-a26
commented
Oct 29, 2025
- A 32-bit CSRF Token will be generated when logged in. Added to both response X-CSRF-Token header and to the cookie.
- Requests that are not authenticated i.e Login, Register etc. need not pass the token in header
- Created a middleware CSRFMiddleWare in util to check whether cookie and header token matches.
|
@Ashrockzzz2003 Please review and let me know If I need to make any changes |
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.
can we hide it behind a feature flag (env var)?
the other evoc services make requests to this auth and they might not work without changes there.
|
Sure, so if that var is set to false, the whole CSRF is disabled. Something like that right? |
|
Yes |
|
Done with that change @Ashrockzzz2003 |
Ashrockzzz2003
left a comment
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.
Thanks Sharath
But you need to add csrf to controller/grpc/authenticate.go too as this is the function that'll be called via grpc by other microservices to authenticate requests.