jjs with support for Security Manager?

Bernd Eckenfels ecki at zusammenkunft.net
Tue Feb 4 18:08:16 PST 2014


Hello,

I tried to use jjs to do some tests with the Java security manager,
however it does not completely work:

a) when starting jjs with -Djava.security.manager no SM is installed:

C:\Program Files\Java\jdk1.8.0\bin>jjs -Djava.security.manager          
jjs> java.lang.System.getSecurityManager()                              
null                                                                    

This is normally the job of the launcher, so I guess this is a problem in the jjs binary.

b) when installing the SM by hand it seems to have a deny-all policy:

C:\Program Files\Java\jdk1.8.0\bin>jjs
jjs> var Manager = Java.type("java.lang.SecurityManager")
jjs> java.lang.System.setSecurityManager(new Manager)
null
jjs> java.lang.System.getSecurityManager()
java.lang.SecurityManager at 51b279c
jjs> java.lang.System.getPropert("java.version")
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.version" "read")
jjs> exit()
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")

However I cannot use java.security.debug=all to see where the problem is. No idea why this is. Maybe it is related to the way system properties are set with jjs? Any ideas?

Greetings
Bernd


More information about the nashorn-dev mailing list