I am creating a browser game and im using a lot of ajax instead of refreshing the pages. I am using php and javascript. After a lot of work, I noticed that ajax is not completely safe. The threats that worry say that someone wants to find some information on my SQL server, she just needs to provide the correct information in my .php file associated with my ajax calls. I used the GET style of ajax calls, which was a bad idea. In any case, after many studies, I have the following safety measures. I switched to POST (which is actually not more secure, but its slight deterrent). I have a link to a place that can again be tampered with, but again its another deterrent.
The last measure is in my place and is the focus of this issue when my site is loaded. I have an 80 char hex key generated and saved in a session, and when I send an ajax call, I also send a call key in the form
challenge= <?php $_SESSION["challenge"]; ?>
now that the ajax php file reads this, it checks to see if the call being sent matches the session. Now this in itself will not affect much, because you can just open firebug and see that the call is sent easily. So what I do is once this problem is used, it generates a new one in the session.
So my question is how safe is it from where it is standing, it can only see what kind of call it is, after it has been sent, and then it is updated, and they cannot see it again before it sending, making it impossible to send a fake request from another source. So does anyone see a hole in this security method or have any additional thoughts or ideas.
javascript jquery html ajax php
tye
source share