Video in progress
The Security Manager was removed completely in JDK 24. Your platform runs users' plugins or scripts. How do you do isolation now?
The Security Manager was never a reliable sandbox, and now it is gone entirely (deprecated in JEP 411, removed in JEP 486). Untrusted code can't be protected within one JVM, so I move isolation to the process or container level, and inside the JVM I give only a restricted API (a DSL, WASM, a GraalVM polyglot sandbox).
📖 Answer
It used to be common to design things as "we run the plugin under the SecurityManager and don't allow file or network access". In practice it was complex, slow and bypassed many times. And it never gave resource limits: an infinite loop or 10 GB of allocation still kills the whole JVM.
The options now, by trust level:
-
The code is trusted (internal teams). Isolation here is protection against mistakes, not attacks. A separate classloader, a clear interface, timeouts, bounded executors and bulkheads are enough.
-
The code is semi-trusted or external. A separate process or container per plugin/tenant:
- limits at the OS level: cgroups (CPU, memory), seccomp, a read-only file system, network policy;
- communication over gRPC or a message queue;
- a crash or OOM kills only that worker. The cost is startup time and resources, softened by a worker pool and reuse.
- Small pieces of user logic (formulas, rules). Not full Java but a restricted language:
- your own DSL, or an expression language like CEL, safe at the syntax level;
- a WebAssembly runtime (for example Chicory, pure Java), with limited memory and instructions;
- a GraalVM polyglot sandbox (with resource limits, for JavaScript/Python).
Migration: find the leftovers of System.getSecurityManager() and AccessController.doPrivileged in your code (jdeps, grep), and keep in mind that -Djava.security.manager=allow no longer works. If libraries call these APIs, they still exist but do nothing.
The main idea: "one JVM, one trust domain". Running different tenants' untrusted code in one heap relies on hope, not on what the JVM can do.
Sign up to mark studied questions and save your progress.