diff --git a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java index 1fc4b911..35079af5 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java @@ -89,9 +89,15 @@ public static void setConfig(LauncherConfig cfg) @LauncherAPI public static URL getResourceURL(String name) throws IOException { + LauncherConfig config = getConfig(); + byte[] validDigest = config.runtime.get(name); + if (validDigest == null) + throw new NoSuchFileException(name); // Resolve URL and verify digest URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name); + if (!Arrays.equals(validDigest, SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, url))) + throw new NoSuchFileException(name); // Digest mismatch // Return verified URL return url;