AJAX In Action [138]
7.5 Summary
In this chapter, we discussed security implications of using Ajax. We concentrated on security issues that were different for Ajax than for conventional web Licensed to jonathan zheng 278 CHAPTER 7 Security and Ajax applications. First, we looked at the sandbox governing the use of JavaScript within the web browser and the rules that prevent code from different sources from interacting with each other. We saw how to relax the server of origin policy, with the user’s consent, in order to access third-party Internet services such as the Google API. Second, we looked at ways of protecting data as it passes between the client and the server. HTTPS is the recommended industry-strength solution here, but we also presented a simple Ajax-based way of transmitting passwords securely over plain-text HTTP. Finally, we saw how Ajax has a specific vulnerability owing to the way raw data is provided for consumption from the server. Having evaluated this as a serious threat in some cases, we looked at ways of designing the server architecture to minimize exposure to such risks. We also described ways of programming the server to make external access to data more difficult. The issues that we’ve tackled in this chapter should help you to tighten up your Ajax applications for use in the real world. In the next chapter, we continue the theme of grim realities with a look at performance issues. 7.6 Resources Keys for the Google web service APIs may be obtained at http://www.google.com/ apis/. The JavaScript MD5 libraries of Paul Johnston can be found at http:// pajhome.org.uk/crypt/md5/md5src.html. For those wanting a quick taste of MD5, visit the online checksum generator at www.fileformat.info/tool/hash.htm?text= ajax+in+action. The Apache Commons Codec library for Java, which we used to generate our Base64-MD5 on the server, can be downloaded at http://jakarta.apache.org/commons/codec/. In section 7.1, we looked at signing JAR files to create secure applications for Mozilla browsers. The official word on that can be found at www.mozilla.org/ projects/security/components/signed-scripts.html. You’ll find some background information on the Battleship game at http://gamesmuseum.uwaterloo.ca/vexhibit/Whitehill/Battleship/. Licensed to jonathan zheng Performance This chapter covers ■ Profiling Ajax applications ■ Managing memory footprints ■ Using design patterns for consistent performance ■ Handling browser-specific performance issues 279 Licensed to jonathan zheng 280 CHAPTER 8 Performance In the previous three chapters, we have built up our understanding of how Ajax applications