SECURITY
A lot has been published about Ajax security; in fact, there are entire books dedicated to the topic. Security considerations for large-scale Ajax applications are vast, but there are some basic things to understand about Ajax security in general.
First, any URL that can be accessed via Ajax can also be accessed by a browser or a server. For example, consider the following URL:
/getuserinfo.php?id=23
If a request is made to this URL, it will presumably return some data about a user whose ID is 23. There is nothing to stop someone from changing the URL to a user ID of 24 or 56 or any other value. The getuserinfo.php
file must know whether the requestor actually has access to the data that is being requested; otherwise, you have left the server wide open to relay data about anyone.
When an unauthorized system is able to access a resource, it is considered a cross-site request forgery (CSRF) attack. The unauthorized system is making itself appear to be legitimate to the server...