r/programming • • 5d ago

Java4Shell is a reason to use Java

https://mccue.dev/pages/11-18-26-java4shell
49 Upvotes

50 comments sorted by

View all comments

Show parent comment

-1

u/Virviil 2d ago edited 2d ago

Its statements contradicts themselves.

If dependencies are NOT allowed not use native code - they are slow and so my Java program is. If dependencies ARE allowed - Java is the same “vulnerable” as other languages.
If dependencies turring-full compiles JIT into native - it’s impossible to audit

2

u/bowbahdoe 2d ago

Well take for context that the response above is framed by the way the first person framed it. 

If dependencies are NOT allowed to use native code

  • They are pure Java and are optimized like the rest of your program. Probably worst case it's like 2.5x slower or something. It's not Python where it's 50x (and like I alluded, sometimes it's 1x or 0.9x. really depends on the code)

If dependencies are allowed to use native code

  • You have to explicitly add a flag to enable it, so at least you are aware that you have a different risk profile than pure Java
  • You can have that flag be per-library so you know exactly what you need to audit deeply to have confidence you don't have buffer overflows

And in both situations 

  • you need to trust the native code in the VM. But at least that's only one "thing." Let's audit it more, of course. Or find ways to make it safer by construction. But it does make it so most people don't need to go to these depths.