Chapter 4. The Security Manager Class
When most people think of Java security, they think of the protections afforded to a Java program—and, more particularly, only by default to a Java applet—by Java’s security manager. As we’ve seen, there are other important facets of Java’s security story, but the role played by the security manager is of paramount importance in the degree to which your machine will be safe from malicious Java programs.
On one level, the Java security manager is simple to understand, and it’s often summarized by saying that it prevents Java applets from accessing your local disk or local network. The real story is more complicated than that, however, with the result that Java’s security manager is often misunderstood. In this chapter, we’ll look into how the security manager actually works, what it can and can’t do, and when it does—and doesn’t—protect you. In this chapter, we’re only going to look at the security manager in terms of its capabilities, with an emphasis on how those capabilities are used by popular browsers; we’ll look into writing our own security manager in the next few chapters.
Overview of the Security Manager
On a simple level, the security manager is responsible for determining most of the parameters of the Java sandbox—that is, it is ultimately up to the security manager to determine whether many particular operations should be permitted or rejected. If a Java program attempts to open a file, the security manager decides whether or not that ...