How to properly block a file that is called through AJAX? How do you prevent someone from directly accessing the response URL and receiving a response?
To help explain, I will use an example of an automatic suggestion function; In particular, entering a few letters will display a list of all members matching this phrase.
So, somewhere in Javascript, you are defining the URL "http://mysite.com?code=". Then in the search script we have
loginRequest.open("GET", url + characters, true);
and it returns the XML of all members that have “characters” somewhere in their name. What prevents a hacker from entering this URL directly into the browser and repeatedly sending new fragments of names, trying to get my entire membership database?
Not a single web example I came across seems to address this issue.
Am I just (wrong) paranoid?
source
share