Skip to content

Improve file type check for AAR#1987

Merged
Goooler merged 5 commits intomainfrom
copilot/update-aar-file-check
Mar 19, 2026
Merged

Improve file type check for AAR#1987
Goooler merged 5 commits intomainfrom
copilot/update-aar-file-check

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Replaces the extension-only check for AAR files with a content-based inspection, fixing both false negatives (real AARs with .jar extension slipping through) and false positives (non-AAR files with .aar extension incorrectly blocked).

Changes

  • ShadowJar.kt: Replace file.extension.equals("aar", ignoreCase = true) with file.isAar() — a private extension that opens the file as a ZipFile and checks for the presence of AndroidManifest.xml (mandatory in the AAR spec). Catches ZipException only, so real I/O errors still propagate.
  • JavaPluginsTest.kt: Update failBuildIfProcessingAar to use a real AAR-shaped ZIP (via buildJar + AndroidManifest.xml entry) instead of an empty file. Add failBuildIfProcessingAarWithJarExtension to cover the previously undetected case where an AAR is named with a .jar extension.

  • CHANGELOG's "Unreleased" section has been updated, if applicable.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED -o /tmp/test-download.jar (dns block)
  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Copilot AI changed the title [WIP] Update verification for AAR file types Check AAR file type by content (AndroidManifest.xml) instead of extension Mar 19, 2026
Copilot AI requested a review from Goooler March 19, 2026 05:47
@Goooler Goooler marked this pull request as ready for review March 19, 2026 05:53
@Goooler Goooler changed the title Check AAR file type by content (AndroidManifest.xml) instead of extension Improve file type check for AAR Mar 19, 2026
@Goooler Goooler enabled auto-merge (squash) March 19, 2026 06:02
@Goooler Goooler merged commit 69dfdfc into main Mar 19, 2026
6 checks passed
@Goooler Goooler deleted the copilot/update-aar-file-check branch March 19, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants