beanshell AccessControlException
Submitted by Trickkiste on Mon, 09/20/2004 - 11:44.
hi,
I tried to run a beanshell script, but I got an:
java.security.AccessControlException:
Permission "(java.util.PropertyPermission user.dir read)"
not granted due to bsh.Interpreter
...
...
Andreas
- Login to post comments
Problems
Hi,
You have two problems below, (cnfe, and ace) both of wich arise from the idea that the beanshell doesn't do anything for itself. The bsh calls precoded methods arbitrarily based on what the script it is interpriting says. I has no ability to determin what it is actualy doing, it just obeys.
Because the beanshell resonds dynamically you will never be able to supply enough permissions or class access tags (import) in the descriptor to make it capable of using any function (method) in the system.
In order to fulfill dynamic needs you must be able to resond dynamically. This is what I suggest.
* Allow for inter-plugin class loading, by name and plugin uid (or name+version).
If plugin A states specificaly to import plugin B then search for classes in B first. But if you dont find the class you need there, then search in all of the plugins until you find it. This allows a plugin to state specifically the things that it needs, but also gives it dynamic access to all the classes in the system.
* Create a dynamic user driven permisission system. When a class is isolated by the AccessControler as not having the right permissions, see if the user has denied that class (or plugin) the permission, if the user has not denied it, then ask the uer (graphically) if he will grant it, then save that information for latter. See this
class not found...
Hi,
I managed to run basic bsh scripts (e.g. with print() in it).
I tried to run a script with following statement:
ifconfig eth0 192.168.0.1
What I got was a Exception (class not found).
Afterwards I tried org.jnode.net.Command.IfconfigCommand eth0 192.168.0.1
but it didn't work.
Any Ideas?
Andreas
I'm doing some test with the
I'm doing some test with the plugin command and tftp of plugins, but sometimes I get Exceptions and there after I can't use the commands, like ifconfig and even alias. It sound like it could be the same problem.
Martin
so far
Hi,
I added the following to the descriptor:
<extension point="org.jnode.security.permissions">
<permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read"/>
<permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
<permission class="java.util.PropertyPermission" name="debug" actions="read"/>
<permission class="java.util.PropertyPermission" name="trace" actions="read"/>
<permission class="java.util.PropertyPermission" name="localscoping" actions="read"/>
<permission class="java.util.PropertyPermission" name="outfile" actions="read"/>
</extension>
After starting with bsh I got :
Starting Interactive beanshell.
BeanShell 2.0b1.1 - by Pat Niemeyer (pat@pat.net)
bsh%
which is followed by the following Exception:
java.securityAccessControlException: Permission "(java.lang.RuntimePermission exitVM)" not granted due to bsh.Interpreter
...
bsh.Interpreter!run (-1 [java.lang.System#exit 612])
...
Andreas
there are more...
Hi,
I changed the descriptor of the beanshell plugin, but there are more exceptions. I try to solve all of them (concerning Permissions).
Andreas