Weird Thoughts From Eric's Head

Tags - Categories : All | AJAX | BUSINESS | PERSONAL | PROGRAMMING | BOOK REVIEW

Ajax: Is talking to outside domains safe?

One of the topics that pops up all of the time is the XMLHttpRequest's inability to talk to any domain outside of its own. Yes we can change this by altering the browser settings, playing with the privilege manager, and signing scripts. These things are extra steps that people do not want to do when developing a small application. Plus they also add insecurity about the user's actions on the options they choose when visiting your site.

I personally do not think that the browser should be able to open requests to another domain. This would be opening a security hole. I am probably one of the only developers that believe this, but I see it as a bigger issue in my eyes with script kiddies and people up to no good.

Everyone thinks that it would be better to make a request to the outside domain. I rather call my server side page on my domain and have that retrieve the data. Now I can cache this data on my server so I do not have to go and keep getting the data. Caching this data on the client is not really possible if we are talking page refresh and traditional postbacks. We would loose this data and have to get it over and over on an uncertain crowded congested pipe across the internet. What if your server is in the US, the client is in the US, and the remote service is in India. The request has to travel halfway around the world and back to retrieve the same information it could have had on its US server. You are talking increased time having to wait for information.

If the client can hold session data, then we may be able to open up requests to outside domains, but we would have to some how secure this new data transfer or will see bigger holes for people to attack.

Eric Pascarello
Coauthor of Ajax In Action
Moderator of HTML/JavaScript at www.JavaRanch.com
Author of: JavaScript: Your Visual Blueprint for Dynamic Web Pages


This is the same sort of security model as Java's "sandbox" for Applets. It is perfectcly logical. There is no way for me to control what a script on another domain does, so I certainly won't trust it.
Perhaps the security of the AJAX applications should not be based on JavaScript but on the underlying server engine.


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 8 + 8 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/pascarello/addTrackBack.action?entry=1132327867093