Issue #3653 Ensure custom SecurityManager.checkPermission is used. (#3654)

* Issue #3653 Ensure custom SecurityManager.checkPermission is used.
This commit is contained in:
Jan Bartel 2019-05-17 16:28:42 +02:00 committed by GitHub
parent 5760795f96
commit 671d1cb2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -308,6 +308,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void setUsingSecurityManager(boolean usingSecurityManager) public void setUsingSecurityManager(boolean usingSecurityManager)
{ {
if (usingSecurityManager && System.getSecurityManager() == null)
throw new IllegalStateException("No security manager");
_usingSecurityManager = usingSecurityManager; _usingSecurityManager = usingSecurityManager;
} }
@ -2612,7 +2614,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
else else
callerLoader = callerLoader.getParent(); callerLoader = callerLoader.getParent();
} }
AccessController.checkPermission(new RuntimePermission("getClassLoader")); System.getSecurityManager().checkPermission(new RuntimePermission("getClassLoader"));
return _classLoader; return _classLoader;
} }
} }