Java's original security model — the Security Manager — was designed for an era when applets ran arbitrary code in browsers. The Security Manager allowed fine-grained policy enforcement: a sandbox could deny file access, network access, reflection. The model worked but was complex; few production applications actually used it well.
In modern Java, the Security Manager is deprecated (Java 17) and slated for removal. The replacement is a different model: module encapsulation, validated dependencies, OS-level sandboxing. This page is about what the current Java security story actually is.
The Security Manager intercepted operations:
Policy files defined per-codebase permissions. Applets ran with restricted permissions; trusted code (signed JARs from known sources) ran with more.
Why it died:
Modern Java security relies on multiple layers:
Modules exports only what's intended public. Reflective access requires explicit opens. Internal classes are not callable from other modules without explicit cooperation.
This is finer-grained than the old "public/private" boundary at the package level. See JavaModuleSystem.
Java deserialization is the source of many security vulnerabilities — gadget chains in deserialized objects can execute arbitrary code. Java 9+ added ObjectInputFilter to restrict which classes can be deserialized.
Best practice: always use ObjectInputFilter on ObjectInputStream to whitelist deserializable types. Wikantik's deserialization filtering is one example of this discipline.
Production Java increasingly runs in containers with reduced capabilities, secComp profiles, network policies. The OS-level sandbox is now the primary security boundary.
Modern Java security depends heavily on:
These catch vulnerabilities the old Security Manager could not — particularly in dependencies.
What Java developers actually need to think about:
Most security problems in Java applications come from dependencies. The Log4Shell vulnerability (Log4j) is the canonical recent example.
Routine practice:
User input — HTTP requests, file uploads, deserialized data — is the entry point for most attacks. Validate at trust boundaries, not deep inside the system.
Common failure modes:
Build on libraries that get this right (Spring Security, Apache Shiro). Don't roll your own. Common mistakes:
Don't commit secrets to source control. Use vault systems (HashiCorp Vault, AWS Secrets Manager, Kubernetes secrets). Rotate regularly.
Use TLS 1.2 or higher; disable older versions. Verify certificates properly. The TrustManager that returns true for everything is a frequent vulnerability.
java.security, javax.crypto).When the Security Manager is fully removed (planned for future Java versions), code that depended on it will break. Migration paths:
Most production applications never used the Security Manager; they will not be affected.