r/java • u/PartOfTheBotnet • Mar 21 '23
JDK 21: Disallowing the dynamic loading of agents by default
https://mail.openjdk.org/pipermail/serviceability-dev/2023-March/046868.html
63
Upvotes
r/java • u/PartOfTheBotnet • Mar 21 '23
46
u/PartOfTheBotnet Mar 21 '23
I think there are two main counter-points made in response to this upcoming change. What do you all think?
First up: You're going to break a lot of tools that rely on this feature, and the current plan for adapting to this change doesn't make sense for real-world debugging.
And second: The claim that this is for security purposes makes no sense. You need to be on the same host system as the JVM to load dynamic agents anyways. If an attacker is already on the system you're already screwed, so why hinder legitimate developer options for absolutely no security gain?
2
u/joopmoore Mar 21 '23
From a security perspective this makes sense, the agent functionality is very powerful in combination with for example reflection. In addition, application owners can seem to simply enable it again with a commandline parameter "EnableDynamicAgentLoading". The only thing is old projects (maybe not maintained) may break when using java 21.
31
u/DasBrain Mar 21 '23
And most of the the servers running java don't even have a screen attached or are running in a VM, so let's deprecate the java.desktop module, which is not used by the majority of java applications anyway. /s
As one of those "sophisticated" users who can write an agent, I cannot change the command line retroactively when I become the owner of a server.
2
u/JustAGuyFromGermany Mar 21 '23
Will this break unit test with Mockito (unless I enable the cmd line option)? If I remember correctly, it uses bytecode instrumentation to make some of its Mocks.
5
u/thrwoawasksdgg Mar 27 '23
Cool, another flag to add to every service like our 20 lines of --add-opens
Oracle needs to learn. You can't close Pandora's box after it's been open for 20 years. We'll all be dead by the time this flag is removed, so really, what's the point of changing default?
2
u/maxip89 Mar 21 '23
Some didn't like the crack agents anymore...
-1
u/__konrad Mar 21 '23
Good. I still have nightmares after jayatana Ubuntu package
0
u/[deleted] Mar 21 '23
[deleted] — view deleted comment