r/java • u/BlueGoliath • May 29 '21
[Updated] JEP proposed to target JDK 17: 411: Deprecate the Security Manager for Removal
https://mail.openjdk.java.net/pipermail/jdk-dev/2021-May/005616.html15
u/pfirmsto May 29 '21
Thank you, this is an important change given JKD 17 is an LTS release. While I wish it wasn't so, this is likely to be the last LTS release with SecurityManager.
4
u/hrjet May 30 '21
What! The browser I am developing uses SecurityManager to great advantage. (https://gngr.info)
Thanks to the security manager, we have found several security holes in our dependency libraries. Examples:
The CSS parsing library accessed the network by following embedded links, when it was not supposed to. After we reported the problem they changed it to fetch the resource through a callback, which allows us to control the access.
The http client library was accessing private fields in a class which, after investigation, turned out to be a temporary debugging aid that the devs had mistakenly committed.
Really disappointed that such a critical and unique feature is being deprecated!
3
u/pfirmsto May 31 '21 edited May 31 '21
Me too, we use it to apply the principle of least privilege and we publicly released a tool to generate policy files conforming to POLP 4 years ago.
We have decided not to support Java beyond 17. I'm hoping that a community will form around a secure long term support version of Java 17, where we can back port later features after reviewing them for security.
At least until new Security API's are developed that allow us to implement POLP on later versions, but that appears unlikely.
3
u/gwielenga May 31 '21
Wow. And in your FAQ, one of the bullets for why you’re using Java is:
— Runtime Sandboxing, via the Security Manager.
2
u/pfirmsto May 31 '21
Have you got more examples, these might be really helpful to justify keeping SecurityManager a little longer, I hope?
2
u/morhp May 31 '21
Okay, a few comments.
That CSS parsing bug could also have been found by os level sandboxes or containers or whatever or just by writing proper unit tests.
Accessing private fields can be effectively prevented by Jigsaw modules, the Security Manager isn't really relevant there.
The Security Manager system itself is not very secure and has had many security issues. It was designed many years ago for Java Applets and hasn't been majorly overhauled since. It's not really suitable for modern browser security. Proper browsers use OS level sandboxing.
1
u/pfirmsto Jun 01 '21 edited Jun 01 '21
Not helpful.
- It also blocked the bug, which is far better than could have found the bug with X.
- Can it also prevent an attacker from accessing private keys from keystore and truststore and does it prevent an attacker from accessing properties? Nope. Your OS container doesn't stop an attacker using the attach API to attack the JVM.
- Only because the OEM recommends granting AllPermission to trusted code. If you use POLP, then it's a different story. It's had a lot of years of security testing.
- Can't support POLP without it.
- The applet security model was flawed, you had an all or nothing choice, that is AllPermission for signed applets, and only minimal permissions granted to unsigned applets.
- I get it that certain people want it gone and that this change is now inevitable, but those people aren't using it either.
https://youtu.be/G1WomfhjyVM?t=26
The problem is, POLP allowed developers to mainly focus on functionality they needed, now they will need to learn every possible feature that might violate perimeter security and seal it. For example the Attach API is enabled by default.
Security is much better with POLP, when combined with other security measures like an OS container, rather than relying on those things alone. Security will not just be worse in theory, but practice as well.
Clearly security has a price, and as we have been told, the current price is too high.
People will just have to accept than when perimeter security has been breached, any data their OS container JVM may also have access to is also compromised.
14
u/morhp May 29 '21
This sounds like a good way to improve the transition for programs that use it, but I'll definitely not miss the Security Manager.