views:

234

answers:

3
+3  Q: 

AJAX Security Norm

Is there a norm for AJAX security?

When making an XMLHttpRequest, if querying an HTTPS url, will the browser handle all the certificate business and properly encrypt the request (or use an already existing authenticated tunnel)? Are there any security flaws in this model?

Then there's also user authentication issues with AJAX. This made me think that using the user's password to encrypt part or all of an AJAX request could solve some authentication issues. I've seen some impressive javascript based encryption tools. It seems like there'd be lots of potential there to build a single system that takes care of both encryption and authentication(host level and application user level). I have however not seen anything that seems 'tried an true'.

My question can be summed up as:

Is there a norm for secure AJAX either using browser technologies or client side javascript? What is it? And if not, what's preventing us from building one using javascript?

Thank you, as always.

A: 

Ajax does not inherently introduce new security vulnerabilities in the realm of web applications. Instead, the applications face the same security issues as classic web applications. Unfortunately, common Ajax best practices have not been developed, which leaves plenty of room to get things wrong.

from: http://www.securityfocus.com/infocus/1868

carrier
+2  A: 

SSL through HTTPS is sort of a cooperative venture with the destination server. The destination server will report its identity with its identity certificate (sent back to the client). This is part of the protocol that will encrypt the data stream between the client and the server.

However, this just encrypts the stream, it does nothing about several other security issues. Identification and authentication of the user entity making a request is handled through other means. If you're encrypting the stream with SSL, it should be safe to use HTTP basic auth. After that, the response to authentication should be a session id sent back to the client that will pass it back on all subsequent requests. Application servers typically manage the creation of those session ids.

David M. Karr
A: 

Basic authentication makes sense. I found this article explaining how to do it.

I somehow still have this desire to not use all the browser technologies and encrypt/authenticate things myself. Not sure if that would make any sense. Key caching would be hard to accomplish.

I'm still looking to find out if this (SSL + using basic auth in ajax calls) is the norm.

Mr Grieves
Building your own encryption is almost never the right idea.
Zoredache
Wouldn't be own encryption. Would be using industry standard encryption implemented by others in javascript to build own security. But yeah, I agree.
Mr Grieves