Code Comments
Programming Forum and web based access to our favorite programming groups.I'm trying to solve how to code a system where an Java application loads external classes with class loader. The problem is that those externally loaded classes can be malicious so i must somehow limit their actions. Is it valid solution to create a new SecurityManager that "denies everything" only in the case that there is a class loaded with a certain classloader in the stack? Example source from http://forum.java.sun.com/thread.js...4&thread=457210 public class MySecurityManager { public MySecurityManager() {} public void checkRead(String file) { Class[] c = getClassContext(); // current execution stack for (int i = 0; i < c.length; i++) { ClassLoader cl = c[ i ].getClassLoader(); if (cl != null) { if (cl.getClass().equals(MyClassLoader.class)) throw new SecurityException(); } } } } Michael Maier
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.