Do I need a CSRF token for jQuery .ajax()?

后端 未结 4 1432
野趣味
野趣味 2020-12-08 07:20

So I\'ve got a basic .ajax() POST method to a PHP file.

What security measures do I need?

A few posts around were mentioning using a hidden MD5 input field t

4条回答
  •  忘掉有多难
    2020-12-08 08:12

    In terms of request forgery, it doesn't matter how the client sends the request it matters how its received. The same CSRF rules apply for an ajax post as any other type of post.

    I recommend reading the CSRF prevention cheat sheet. Using a per-user secret token is the most common form of protection.

提交回复
热议问题