Custom classloader & sandbox

Hi all,

I have an applet which consists of two jar files. One unsigned with the main class and one which is signed and includes some optional classes which require extra privileges out of the sandbox.

When I boot the applet it loads in sandbox mode without throwing a security warning. When at runtime I create an instance from a class from the signed jar it will nicely throw a security warning wether the user wants to accept the certificate from the signed jar. This signed jar will then create a custom (url)classloader, which downloads an additional jar at runtime and executes it.

So far so good, but I noticed that the runtime downloaded classes may only use sandboxed methods. When I runtime download some classes which execute methods that reach out of the sandbox they fail with a java.security.AccessControlException.

These runtime classes are loaded through my custom classloader (which resides in the signed jar). I signed the jar which is downloaded at runtime with the same certificate. Also the privileged calls in the runtime classes are wrapped in AccessController.doPrivileged blocks. I thought these runtime loaded classes would inherit the permissions from their parent, which was granted permission by the user to escape the sandbox...

Does anyone know how I can force the extended priviliges to apply to my runtime loaded classes as well? Maybe sticking a custom securitymanager with my custom classloader?

Thanks!

Thijs

[1492 byte] By [_thijsa] at [2007-11-27 11:57:58]
# 1

did the user give your jar privilege to grant privileges to other jars?

_dnoyeBa at 2007-7-29 19:16:59 > top of Java-index,Core,Core APIs...
# 2

I don't know... Is it possible to explicitly request that permission (in code)?

The way I do it now is by having some classes that do some privileged actions in a accesscontroller.doprivileged block. This works fine for the jar bundled in the applets archive tag, but not for the runtime downlaoded classes.

_thijsa at 2007-7-29 19:16:59 > top of Java-index,Core,Core APIs...