Cross Site Request Forgery (CSRF) is typically prevent with one of the following methods:
My idea is to use a user secret, a cryptic but static form id and JavaScript to generate tokens.
<form method="POST" action="/someresource" id="7099879082361234103">
<input type="hidden" name="token" value="generateToken(...)">
...
</form>
GET /usersecret/john_doe
fetched by the JavaScript from the authenticated user.OK 89070135420357234586534346
This secret is conceptionally static, but can be changed every day/hour ... to improve security. This is the only confidential thing.generateToken(7099879082361234103, 89070135420357234586534346)
Is something wrong with this approach, despite the fact that it doesn't work without JavaScript?
Addendum: