mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Фикс обхода на основе глобальных переменных
This commit is contained in:
parent
d84193d5a4
commit
01fd6d2689
3 changed files with 10 additions and 4 deletions
|
@ -149,6 +149,7 @@ public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
||||||
|
|
||||||
public static void main(String... args) throws Throwable {
|
public static void main(String... args) throws Throwable {
|
||||||
JVMHelper.verifySystemProperties(Launcher.class, true);
|
JVMHelper.verifySystemProperties(Launcher.class, true);
|
||||||
|
EnvHelper.checkDangerousParametrs();
|
||||||
LogHelper.printVersion("Launcher");
|
LogHelper.printVersion("Launcher");
|
||||||
// Start Launcher
|
// Start Launcher
|
||||||
Instant start = Instant.now();
|
Instant start = Instant.now();
|
||||||
|
|
|
@ -415,6 +415,7 @@ public static void main(String... args) throws Throwable {
|
||||||
}
|
}
|
||||||
checkJVMBitsAndVersion();
|
checkJVMBitsAndVersion();
|
||||||
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
||||||
|
EnvHelper.checkDangerousParametrs();
|
||||||
LogHelper.printVersion("Client Launcher");
|
LogHelper.printVersion("Client Launcher");
|
||||||
// Read and delete params file
|
// Read and delete params file
|
||||||
LogHelper.debug("Reading ClientLauncher params");
|
LogHelper.debug("Reading ClientLauncher params");
|
||||||
|
|
|
@ -8,13 +8,10 @@
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public class EnvHelper {
|
public class EnvHelper {
|
||||||
private static final boolean TST;
|
private static final boolean TST;
|
||||||
private static final boolean HASXM;
|
private static final boolean HASXM;
|
||||||
@LauncherAPI
|
|
||||||
public static final String[] toTest;
|
public static final String[] toTest;
|
||||||
@LauncherAPI
|
|
||||||
public static final Pattern[] test;
|
public static final Pattern[] test;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -24,7 +21,6 @@ public class EnvHelper {
|
||||||
HASXM = check1();
|
HASXM = check1();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void addEnv(ProcessBuilder builder) {
|
public static void addEnv(ProcessBuilder builder) {
|
||||||
if (hasOptsVar()) {
|
if (hasOptsVar()) {
|
||||||
Map<String, String> repl = new HashMap<>();
|
Map<String, String> repl = new HashMap<>();
|
||||||
|
@ -35,6 +31,14 @@ public static void addEnv(ProcessBuilder builder) {
|
||||||
JVMHelper.appendVars(builder, repl);
|
JVMHelper.appendVars(builder, repl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void checkDangerousParametrs()
|
||||||
|
{
|
||||||
|
for(String t : toTest)
|
||||||
|
{
|
||||||
|
String env = System.getenv(t);
|
||||||
|
if(env.contains("-javaagent") || env.contains("-agentpath") || env.contains("-agentlib")) throw new SecurityException("JavaAgent in global optings not allow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean check0() {
|
private static boolean check0() {
|
||||||
for (String test : toTest) if (System.getProperty(test) != null) return true;
|
for (String test : toTest) if (System.getProperty(test) != null) return true;
|
||||||
|
|
Loading…
Reference in a new issue