The Java Security Manager was deprecated for removal in JDK 17 by JEP 411 [1]. It will be permanently disabled soon, possibly in JDK 24, as proposed by candidate JEP 486 [2]. Once this is done, System::getSecurityManager will unconditionally return null, System::setSecurityManager will unconditionally throw UnsupportedOperationException, and running "java -Dsecurity.manager" will cause the VM to exit with a fatal error.
Initial work needed to implement this:
* Fail fast at startup if the Security Manager is enabled
* Remove -Djava.security.manager and all security policy files
* Delete all tests that depend on the Security Manager; some might have value as functional tests, so could be reworked instead of removed.
* API spec change to remove mention of security manager (including mention of throwing SecurityException)
I will file additional JBS issues to track follow-up work to cleanup the remaining calls to the security manager methods that are deprecated for removal. The follow-up work can be done independently of the timing of the integration of JEP 486 into JDK 24.
Follow-on issues for JavaFX 24:
* Remove all calls to doPrivileged (there are 350 such calls in 168 files)
* Remove all other calls to AccessController (48 calls in 33 files)
* Remove all remaining calls to System::getSecurityManager (45 calls in 27 files)
* Remove calls to deprecated SM methods from PlatformUtil and MethodUtil in javafx.base (these are lightly modified copies of those classes in java.base so I will check how they are being handled)
* Remove all uses (either throw or catch) of the deprecated AccessControlException : : 4 occurrences in 4 files
* Remove all occurrences where we throw a SecurityException; check all place where we catch it (and consider whether it is needed)
* Check and remove any remaining usages of other SM methods that are deprecated for removal by JEP 411
* SecurityManager 2 files (in addition to the ones that call getSecurityManager)
* AccessControlContext: 169 occurrences in 65 files (many are associated with doPriviliged calls, so should be rechecked once doPriv is removed)
* Utility method for fail fast SM check (if we keep the check, else remove it)
NOTE: I had earlier thought that the "fail fast" could be temporary until all follow-up work is done, but I now think we should leave it in for JavaFX 24, possibly adding it to two other classes -- ReflectUtil and MethodUtil -- depending on the follow-up work needed for those classes. If we do end up leaving it, I'll create a utility method in javafx.base that will use reflection to check whether the security manager is enabled, so we don't leave in a call to a method (System::getSecurityManager) that is deprecated for removal.
We might also file additional follow-up issues, not necessarily targeted for JavaFX 24:
* Consider deprecating for removal the following security-related APIs in JavaFX
* FXPermission (this PR changes the spec to make it clear that it is no longer used to control access to resources)
* WebErrorEvent.USER_DATA_DIRECTORY_SECURITY_ERROR (if there is no other use than to report a SecurityException that can no longer happen after the security manager is removed)
[1] https://openjdk.org/jeps/411
[2] https://openjdk.org/jeps/486
- blocks
-
JDK-8342461 Remove calls to doPrivileged in javafx.web/{android,ios}
- Open
-
JDK-8342453 Remove calls to doPrivileged in javafx.graphics/com.sun.javafx.tk
- Resolved
-
JDK-8342454 Remove calls to doPrivileged in javafx.graphics/com.sun.glass
- Resolved
-
JDK-8342456 Remove calls to doPrivileged in javafx.graphics/other
- Resolved
-
JDK-8342457 Remove calls to doPrivileged in swing
- Resolved
-
JDK-8342459 Remove calls to doPrivileged in javafx.base
- Resolved
-
JDK-8342460 Remove calls to doPrivileged in javafx.web
- Resolved
-
JDK-8342911 Remove calls to doPrivileged in controls
- Resolved
-
JDK-8342912 Remove calls to doPrivileged in fxml
- Resolved
-
JDK-8342913 Remove calls to doPrivileged in media
- Resolved
-
JDK-8342914 Remove calls to doPrivileged in swt
- Resolved
-
JDK-8342992 Security manager check should not use deprecated methods
- Resolved
-
JDK-8342993 Remove uses of AccessController and AccessControlContext from JavaFX
- Resolved
-
JDK-8342994 Remove security manager calls in com.sun.javafx.reflect
- Resolved
-
JDK-8342997 Remove use of System::getSecurityManager and SecurityManager from JavaFX
- Resolved
-
JDK-8342998 Remove all uses of AccessControlException
- Resolved
-
JDK-8344431 Remove remaining security manager calls from javafx.web/{android,ios}
- New
-
JDK-8342441 ☂ Remove all calls to doPrivileged
- Resolved
-
JDK-8344443 Deprecate FXPermission for removal
- Resolved
- csr for
-
JDK-8341858 Remove support for security manager from JavaFX
- Closed
- relates to
-
JDK-8338411 Implement JEP 486: Permanently Disable the Security Manager
- Resolved
-
JDK-8200082 Need to restrict access to FX packages when loaded by AppClassLoader
- Open
-
JDK-8343630 Pass AccessControlContext to/from WebKit as opaque object
- Resolved
- links to
-
Commit(master) openjdk/jfx/dc5df6c1
-
Review(master) openjdk/jfx/1595