I'm loading untrusted code at runtime and for this reason I'm also writing a custom SecurityManager. This untrusted code however lazy-loads some JRE classes that I do not want to block. Would it be safe if I granted "read" permission to the whole JRE directory (System.getProperty("java.home");)? Otherwise, what are the reasons why doing this would be insecure?

  • "For example, granting permission to access the "java.home" system property gives potentially malevolent code sensitive information about the system environment (the location of the runtime environment's directory)." - download.java.net/jdk8/docs/technotes/guides/security/… – Flavio Sep 5 '13 at 21:46
  • The SecurityManager is not the place you want to do this sort of this. Code loaded by the boot class loader should have full permissions. Apply highly restricted permissions to the loaded classes. The mechanism is through ProtectionDomains added through subclasses of SecureClassLoader. – Tom Hawtin - tackline Sep 6 '13 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.