I wanted to create a very restrictive security manager, so I extended SecurityManager and overridden all the custom checkXXX methods.
But then I found out that my security manager is useless, because anyone can just:
System.setSecurityManager(null);
So I have to add:
@Override public void checkPermission(Permission perm) {
if (perm.getName().equals("setSecurityManager")) {
throw new SecurityException("You shall have no other security manager but me!");
}
}
Are there any more surprises? Any other things I have to do to make my SecurityManager hermetic?