From 005d180e0ce48a0b1eabf2dbd4f0a24e7902767b Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Wed, 29 Dec 2021 23:59:19 +0200 Subject: [PATCH] Fix up-to-date checks for ValidateAccessWidenerTask (#565) * Apply mitigation's against Log4J2 exploit CVE-2021-44228. * Only warn when the yarn version does not match the minecraft version. Should allow yarn versions to be used across mc versions when needed. * Fix up-to-date checks for ValidateAccessWidenerTask Co-authored-by: modmuss50 --- .../loom/configuration/providers/LaunchProvider.java | 1 + .../providers/mappings/MappingsProviderImpl.java | 2 +- .../loom/task/ValidateAccessWidenerTask.java | 3 +++ src/main/resources/log4j2.fabric.xml | 12 ++++++------ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java b/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java index fcfa226..aeb387d 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/LaunchProvider.java @@ -60,6 +60,7 @@ public class LaunchProvider extends DependencyProvider { .property("fabric.development", "true") .property("fabric.remapClasspathFile", getRemapClasspathFile().getAbsolutePath()) .property("log4j.configurationFile", getAllLog4JConfigFiles()) + .property("log4j2.formatMsgNoLookups", "true") .property("client", "java.library.path", nativesPath) .property("client", "org.lwjgl.librarypath", nativesPath) diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java index 2ab18e9..3c84fd9 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java @@ -196,7 +196,7 @@ public class MappingsProviderImpl extends DependencyProvider implements Mappings String yarnMinecraftVersion = yarnVersion.substring(0, yarnVersion.lastIndexOf(separator)); if (!yarnMinecraftVersion.equalsIgnoreCase(minecraftVersion)) { - throw new RuntimeException(String.format("Minecraft Version (%s) does not match yarn's minecraft version (%s)", minecraftVersion, yarnMinecraftVersion)); + getProject().getLogger().warn("Minecraft Version ({}) does not match yarn's minecraft version ({})", minecraftVersion, yarnMinecraftVersion); } // We can save reading the zip file + header by checking the file name diff --git a/src/main/java/net/fabricmc/loom/task/ValidateAccessWidenerTask.java b/src/main/java/net/fabricmc/loom/task/ValidateAccessWidenerTask.java index 51f9d97..4ebbb33 100644 --- a/src/main/java/net/fabricmc/loom/task/ValidateAccessWidenerTask.java +++ b/src/main/java/net/fabricmc/loom/task/ValidateAccessWidenerTask.java @@ -59,6 +59,9 @@ public abstract class ValidateAccessWidenerTask extends DefaultTask { getAccessWidener().convention(extension.getAccessWidenerPath()).finalizeValueOnRead(); getTargetJar().convention(getProject().getObjects().fileProperty().fileValue(extension.getMinecraftMappedProvider().getMappedJar())).finalizeValueOnRead(); + + // Ignore outputs for up-to-date checks as there aren't any (so only inputs are checked) + getOutputs().upToDateWhen(task -> true); } @TaskAction diff --git a/src/main/resources/log4j2.fabric.xml b/src/main/resources/log4j2.fabric.xml index fcfd27b..69c9c0d 100644 --- a/src/main/resources/log4j2.fabric.xml +++ b/src/main/resources/log4j2.fabric.xml @@ -7,7 +7,7 @@ - + @@ -15,9 +15,9 @@ - + - + @@ -25,9 +25,9 @@ - + - + @@ -38,7 +38,7 @@ - +