views:

29

answers:

1

This question is more or less the same as Restrict Certain Java Code in a Plug-In, however the accepted answer was simply to further search with Google, what I already did without having this question answered.

Effectively, I want special security constraints only for code I load via plug-ins.

When a plug-in is loaded and started, all it gets are special objects from my application with which they can interact. Plug-ins shall not be allowed to access the file system, open network connections, etc. They're only allowed to "talk" with the objects I gave them.

However my application loading/running those plug-ins should have no restrictions. In other words, the security should only be enforced to the plug-ins.

There's also a very insightful post on The FogBugz Plugin Architecture, more specifically the part about Plugin Security and AppDomains which exactly is I'm trying to achieve in Java.

Unfortunately I'm not able to answer just the question without implementation whether this is possible and what would be necessary.

+1  A: 

java.security.ProtectionDomain is the Java equivalent of what AppDomains appear to be. However, doing this sort of thing robustly is non-trivial.

Tom Hawtin - tackline
Very helpful for a start. None of any documents I ever found about SecurityManager mentioned a relation to ProtectionDomain, thx!
mark
Technically a SecurityManager could be implemented without going through the `java.security.AccessController` mechanism. It wouldn't actually work (too many assumptions by actual code), but you could do it.
Tom Hawtin - tackline