Do we have to generate a token, for every form in a website? I mean, every-time to generate different token for every requested form? If not, why?
相关问题
- “Zero out” sensitive String data in Swift
- High cost encryption but less cost decryption
- Multiple Django sites on the same domain - CSRF fa
- How to restrict VOB read access in ClearCase (Wind
- CSRF Middleware - change csrf_token output (from x
相关文章
- Warning : HTML 1300 Navigation occured?
- Security concerns about CORS
- How do I prevent SQL injection with ColdFusion
- LINQ to Entities and SQL Injection
- How to use Google application-specific password in
- Will re-populating a password field in a form be a
- AWS - Configuring access to EC2 instance from Bean
- In what case can CSRF-exempt be dangerous?
No, you just need to generate a token on a per-session basis.
Tokens are very unlikely to be leaked accidentally by users and generating a token per form makes things very complicated if a user is browsing the site in two different tabs/windows at once.
In general, it suffices to have just one token per session, a so called per-session token:
If you want to further enhance the security, you can use one token per each form/URL (per-form token) to mitigate the impact when one token leaks (e. g. XSS) as an attacker would only be able to successfully attack that specific form/URL.
But using per-request tokens, i. e. tokens that change with each request, rather cuts the usability of the website as it restricts parallel browsing:
So I recommend you to use either per-session tokens or per-form tokens.