I was hoping to clear up some questions I have been having with AJAX security. So here is a scenario I am trying to wrap my head around.
Lets say I am using AJAX to request some semi-sensitive material to the page. For instance, I am going to pass the user's ID to a php file, and return some information about themselves. Now, what is keeping someone from emulating this Javascript request, and passing different ID's to the PHP script?
An Ajax call is exactly identical to any other HTTP request that you make except that it's asynchronous (it doesn't reload the web browser). So you should be using whatever authentication you currently employ on your web site.
This could either be Windows integrated security, cookies, etc. Basically your PHP script just has to verify that the request is coming from a valid user of your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With