-
Notifications
You must be signed in to change notification settings - Fork 4
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
Token value per session #9
Comments
@playinteractive, thank you for your reply. According to the current approach. the token name and value are stored in the I think you want to separate this associate array and they possibly will be the I think it can be possible, but this is the small change or feature. The decision that it's up to the @s3b4stian. Perhaps it can be the optional method to let developers decide to store them together or separation 👍 . |
Thanks for the question! Yes should be possible but isn't the scope of csrf token. Token should be used on forms where the user do a dispositive action, a delete a modify or an update. On read action it should not be necessary. Set up the token only for forms, look on the OWASP website for more information about this time of web attack! |
Reflecting on the space occupied, I could save in session, only the hash of the name and token value pair in order to save memory or disk space. I have to try the change. However it considers the use of the token only for the forms. |
@s3b4stian, thank you for your reply. I think it's not necessary to separate the token name and value from the If we have to separate this, it's okay to do that 👍. |
Hi peter279k and s3b4stian, Thanks for your reply. What I mean is this (extracted from the sess file):
As you can see there is a lot of "garbage data" in the file, so I have two questions:
Acording to: https://security.stackexchange.com/questions/22903/why-refresh-csrf-token-per-form-request
|
@playinteractive, thank you for your reply. |
Yes true, I'm using now:
And works fine! Thanks. Anyways, maybe you can improve this class adding the possibility to choose using one token per session or request! Cheers. |
Which version are you using. Every token should be removed from the session superglobal when validate method is used. I do more tests tomorrow! |
About your first question, all tokens are working! Could you peste here the code snippet when you check the token? |
Hi @playinteractive , thank you for your reply. According to the source code on this repository, the After calling the I think you will generate the new token before calling @s3b4stian, perhaps we can let the Also, this feature usage should be added in |
Hi there, here is my code to validate: Before send form:
After send form:
@s3b4stian Yes, after calling validate method unset works fine but only when you send the form. If you refresh a login page the class is generating new tokens making the sess file too long. |
Ok! Perfect! To reduce the length of the session file, try to set the class like this: $csrf = new Linna\CsrfGuard(8, 32); Todo
|
@s3b4stian, thank you for your reply. I think it's fine to implement new features for my previous comment. If having any problems, please let me know and I will help you! |
Great, thanks @s3b4stian and @peter279k Cheers! |
Hi,
Is it possible to use one token name & value per session? Now is working on every request and the sess file is too long.
Thanks!
The text was updated successfully, but these errors were encountered: