So, I have a form to make it safer and potentially help prevent CSRF attacks. I want to add a random token value to a hidden field whose value is also stored on the server side in my session data.
When should I issue a new token? In the shape of? The load on the page where there is some form? Per session? I can make it invalid once the form is successfully submitted, but I wonder when to create it.
I ask, as if I gave it to a form or page, I do not risk being able to duplicate the token by overwriting the existing (valid) token, if the user opens a separate window, but sends the first form (with the value now rewritten)?
source
share