mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-03 00:59:39 +01:00
fea7ec356d
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: f0908b66 Add optional 1.17 (21w19a) snapshot protocol support 5fa596fe #3084: (Regrettably) add a full SLF4J wrapper
108 lines
3.7 KiB
Diff
108 lines
3.7 KiB
Diff
From 6263c6b63509c82ce47e619b02513b50cd5baa11 Mon Sep 17 00:00:00 2001
|
|
From: Tux <write@imaginarycode.com>
|
|
Date: Mon, 25 Jan 2016 01:19:07 -0500
|
|
Subject: [PATCH] Get rid of the security manager.
|
|
|
|
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.
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
index 16d4e433..8464fefb 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
@@ -190,8 +190,6 @@ public class BungeeCord extends ProxyServer
|
|
// 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() );
|
|
-
|
|
try
|
|
{
|
|
baseBundle = ResourceBundle.getBundle( "messages" );
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java b/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java
|
|
deleted file mode 100644
|
|
index 53c81923..00000000
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java
|
|
+++ /dev/null
|
|
@@ -1,78 +0,0 @@
|
|
-package net.md_5.bungee;
|
|
-
|
|
-import java.io.PrintWriter;
|
|
-import java.io.StringWriter;
|
|
-import java.security.AccessControlException;
|
|
-import java.security.Permission;
|
|
-import java.util.HashSet;
|
|
-import java.util.Set;
|
|
-import java.util.logging.Level;
|
|
-import net.md_5.bungee.api.ProxyServer;
|
|
-import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
|
|
-
|
|
-public class BungeeSecurityManager extends SecurityManager
|
|
-{
|
|
-
|
|
- private static final boolean ENFORCE = false;
|
|
- private final Set<String> seen = new HashSet<>();
|
|
-
|
|
- private void checkRestricted(String text)
|
|
- {
|
|
- Class[] context = getClassContext();
|
|
- for ( int i = 2; i < context.length; i++ )
|
|
- {
|
|
- ClassLoader loader = context[i].getClassLoader();
|
|
-
|
|
- // Bungee / system can do everything
|
|
- if ( loader == ClassLoader.getSystemClassLoader() || loader == null )
|
|
- {
|
|
- break;
|
|
- }
|
|
-
|
|
- 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 );
|
|
- }
|
|
- }
|
|
-}
|
|
--
|
|
2.31.1
|
|
|