Imagine writing s StarOffice macro in Java
Posted by Adam Warner on May 01, 2006 at 07:34 PM PDT #
Posted by Peter von der Ahe on May 01, 2006 at 07:46 PM PDT #
With a custom classloader one can transform a byte array representation of bytecode into code. There appears to be no way for UNTRUSTED code to do this. To use Java Web Start to do this the client would have to consent to the running of arbitrary signed code just like with Microsoft ActiveX.
Java is also supposed to be a platform where a client can safely run untrusted code within a sandbox. This untrusted code can be downloaded pregenerated from a foreign host for the JVM to verify but it can't be supplied by the client for verification!
In a roundabout way the client could generate the bytecode to compile, pass it to the foreign host to build a jar file, give the name of the jar file to the client and have the client download the jar file. This should not be necessary.
Sun appears to be far more intent upon removing "scary security dialog" boxes to induce people to run arbitrary code: Goodbye scary security dialog box!.
Posted by Adam Warner on May 01, 2006 at 09:16 PM PDT #
Posted by Peter von der Ahe on May 01, 2006 at 09:27 PM PDT #
With some judicious Googling I've discovered this functionality has been in RFE statis since 1996: ClassLoader should allow applet defined classes:
"Applets should be able to define classes from byte arrays, just as they are able to download classes from untrusted web sites. This should be trivial to implement--just skip the downloading step. All the same security checks should be made on the byte code."
Without this any scripting language that generates JVM bytecode is a second class citizen. "It works by compiling the script (a Java program) in memory" doesn't actually work.
Posted by Adam Warner on May 01, 2006 at 10:32 PM PDT #