Search code examples
javasecurityjava-securityjava-security-manager

Prevent Java Application from performing malicious activities


I need to download and run a Jar file. Is there a way to know what it can/will do? I mean what permissions it has? Specifically I need to know if it will try to access my files and if it will try to use my internet. When I download an android application, I can clearly see what permissions it seeks. Is there something similar for Java desktop apps?


Solution

  • The short answer is yes, it does: Java Web Start (which is now removed from Java 11) was enforcing permissions using security policy (which is still available).

    These checks still exists and are thoroughly explained here: https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html

    They are probably rarely used on a desktop app without Java Web Start, but you can always give a try.