From 1493d9d35773b6ccb2418ec7479180d8353d34dc Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 20 Jul 2023 05:01:21 -0400 Subject: [PATCH 1/2] fix: opt out of stricter java rules for zip64 and dot entries (#3178) * fix: opt out of stricter java rules for zip64 and dot entries * test: assert specific system properties for test suite --- .../apktool-cli/src/main/java/brut/apktool/Main.java | 6 ++++++ build.gradle | 4 ++++ 2 files changed, 10 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; 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' } From ab4069306cc1ef31a70421b3988d2bbbc7982970 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 20 Jul 2023 05:19:29 -0400 Subject: [PATCH 2/2] build: test on JDK 20 (#3177) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6dc837e72f..bcc83b3f0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: fail-fast: true matrix: os: [ ubuntu-latest, macOS-latest, windows-latest ] - java: [ 8, 11, 17, 18, 19 ] + java: [ 8, 11, 17, 18, 19, 20 ] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3