There's a lot of opinions running on both sides of the debate, but we overwhelmingly feel that the security manager does not help the vast majority of BungeeCord users or plugin developers create correct code.
// Java uses ! to indicate a resource inside of a jar/zip/other container. Running Bungee from within a directory that has a ! will cause this to muck up.
Preconditions.checkState( new File( "." ).getAbsolutePath().indexOf( '!' ) == -1, "Cannot use Waterfall in directory with ! in path." );
- System.setSecurityManager( new BungeeSecurityManager() );
- AccessControlException ex = new AccessControlException( "Plugin violation: " + text );
- if ( ENFORCE )
- {
- throw ex;
- }
-
- StringWriter stack = new StringWriter();
- ex.printStackTrace( new PrintWriter( stack ) );
- if ( seen.add( stack.toString() ) )
- {
- ProxyServer.getInstance().getLogger().log( Level.WARNING, "Plugin performed restricted action, please inform them to use proper API methods: " + text, ex );
- }
- break;
- }
- }
-
- @Override
- public void checkExit(int status)
- {
- checkRestricted( "Exit: Cannot close VM" );
- }
-
- @Override
- public void checkAccess(ThreadGroup g)
- {
- if ( !( g instanceof GroupedThreadFactory.BungeeGroup ) )
- {
- checkRestricted( "Illegal thread group access" );
- }
- }
-
- @Override
- public void checkPermission(Permission perm, Object context)
- {
- checkPermission( perm );
- }
-
- @Override
- public void checkPermission(Permission perm)
- {
- switch ( perm.getName() )
- {
- case "setSecurityManager":
- throw new AccessControlException( "Restricted Action", perm );