From 2c00c16969d2c3acb0140c8444bc6304550c1452 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Wed, 19 Jul 2023 16:28:46 -0400 Subject: [PATCH 1/2] fix: opt out of stricter java rules for zip64 and dot entries --- .../apktool-cli/src/main/java/brut/apktool/Main.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java index a0fc2c0ec6..b2dbf7f50d 100644 --- a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java +++ b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java @@ -42,6 +42,12 @@ public static void main(String[] args) throws BrutException { // headless System.setProperty("java.awt.headless", "true"); + // Ignore stricter validation on zip files from java 11 onwards as this is a protection technique + // that applications use to thwart disassembly tools. We have protections in place for directory traversal + // and handling of bogus data in the zip header, so we can ignore this. + System.setProperty("jdk.nio.zipfs.allowDotZipEntry", "true"); + System.setProperty("jdk.util.zip.disableZip64ExtraFieldValidation", "true"); + // set verbosity default Verbosity verbosity = Verbosity.NORMAL; From 21a37d675f1bf763aadb131156b0006f969bf215 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Wed, 19 Jul 2023 16:35:51 -0400 Subject: [PATCH 2/2] test: assert specific system properties for test suite --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 70f12cd330..4b7f2733e1 100644 --- a/build.gradle +++ b/build.gradle @@ -142,6 +142,10 @@ subprojects { apply plugin: 'java' test { + // https://github.com/iBotPeaches/Apktool/issues/3174 + systemProperty 'jdk.nio.zipfs.allowDotZipEntry', 'true' + systemProperty 'jdk.util.zip.disableZip64ExtraFieldValidation', 'true' + testLogging { exceptionFormat = 'full' }