POST method, Ajax and security?

I am using Ajax (jQuery) and the POST method to update the data in the database. I do the following:

  • Get data from the form: user_id, entry_id, content, ...
  • Send them to the URL that will process the data.
  • If the data is valid, we will record it in our database.

I do not know how to verify that the user is sending data from my site, and not from other places. Please help me solve this problem. Thank!

+3
source share
2 answers

You are trying to protect against CSRF attacks.

, POST, AJAX. - Javascript, , .

+5

:

  • ,
  • CSRF.

, . , HTTP- ( AJAX) - (, , )

CSRF - , , , AJAX, -. , - , HTTP (NB: Javascript, X-Header).

, ; JSON , , HTTP POST .

+1

Source: https://habr.com/ru/post/1726176/


All Articles