Repository navigation
feat(dex): Android/DEX hardening, R8 recovery, canonical enums, and parallel export (v0.11.0) - #38
Merged
Merged
Conversation
…ms, and parallel archive export - DEX recovery & annotation hardening (internal/dexparser, dex2jar/input): tolerate mismatched DEX SHA-1 headers with valid Adler-32 checksums and orphan AnnotationDefault elements under FailureRecover while preserving FailureStrict failure contracts. - IR & register-kind soundness (dex2jar/ir, dex2jar/lower): fix null-array ops (0x44..0x51), JVMS interface assignability, untyped-null reference joins across non-array uses, multi-kind companion slots/prologue stores, legacy single-kind pinnedZeroKind, zero-source move/stackmap local-kind alignment, and safe try-catch exception table coalescing. - CFG constructor validation & R8 <init> synthesis (dex2jar/r8_init.go, dex2jar/lower/validate.go): synthesize R8-inlined/stripped forwarding <init> chains (including platform exception/core hierarchies and Void-parameter collision disambiguation via PatchedMethods/PatchedNullArgs) plus CFG-based this-initialization, branching/throw-only <init>, discarded filled-new-array, and recovered parameter annotation right-alignment. - Canonical DEX/Kotlin enums & enum decompilation (dex2jar/lower/enum_canonical.go, classparser/decompiler/core): infer declaration ordinal order from <clinit>, emit javac/Kotlin-canonical values()/valueOf()/()///enum-constant bytecode, and delegate sealed SourceAssignmentForward checks in guarded_call_inline.go. - Archive export recovery & throughput (internal/filesys, classparser/jarwar, classparser/dumper.go): sanitize best-effort case-fold archive collisions into __caseN/ subdirectories preserving .java filenames, parallelize DumpToLocalFileSystem deterministically with bounded workers, and sanitize stub method names with SafeIdentifier. - Sealed CI & soundness tests: add Wave 1-3.5 regression tests and sync tools/requiredci/main.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This minor feature release (
v0.11.0) substantially hardensjavajive's pure-Go Android/DEX -> JAR translation (dex2jar), R8 recovery, enum lifting, and best-effort archive decompilation (jarwar) against real-world, R8-obfuscated, and adversarial APKs/AABs while keeping all strict contracts (FailureStrict,filesyssecurity, and strict enum/constructor decompilation proofs) intact.Key Improvements
DEX Recovery & Annotation Fault Tolerance (
internal/dexparser,dex2jar/input,dex2jar/dex2jar.go)AnnotationDefaultelements underFailureRecover(and recover mode), while preserving fail-closed rejection underFailureStrict.method_idsgrowth >65,535 (Code.PatchedMethods,Code.PatchedNullArgs) acrossdex2jar/modelanddex2jar/ir.Sound Bytecode Verification, Register Typing & Exception Coalescing (
dex2jar/ir,dex2jar/lower)ExceptionTablecoalescing and stackmap lowering (stackmap.go), clamping debug positions and empty local ranges (wave1_soundness_test.go).webPolySlots/pinned.polySlots,resolvedDefCategoryAt,resolvedUseCategoryAt), single-kindpinnedZeroKindhandling inassignHomesLegacy, and consistent zero-sourcemove/loadAs/transferSlotFramelocal-kind emission (VerifyErrorelimination).0x44..0x51), JVMS §4.10.1.2 interface verification assignability (references.go), and open untyped-descriptor reference propagation across non-array uses (ir/constants.go,ir/categories.go) so null values merged with array paths lower soundly.CFG Constructor Validation & R8
<init>Synthesis (dex2jar/lower/validate.go,dex2jar/r8_init.go)this-initialization validation (thisUninit/thisInit/thisMixed), supporting mutually-exclusive branching<init>, throw-only<init>, discardedfilled-new-array, and recovered right-aligned constructor parameter annotations.<init>synthesis across multi-DEX hierarchies and platform exception/core superclasses, withLjava/lang/Void;parameter collision disambiguation (PatchedNullArgs) and constructor reuse.Canonical DEX/Kotlin Enum Lowering & Decompiler Cooperation (
dex2jar/lower/enum_canonical.go,classparser/decompiler/core,classparser/decompiler/rewriter)<clinit>(inferEnumFieldOrdinals), fuse pure enum constant allocations in<clinit>, and emit javac/Kotlin-canonicalvalues()(including[Ljava/lang/Object;.clone()),valueOf(String), synthetic$values(),$VALUES, and Kotlin$ENTRIESbytecode sequences.SourceAssignmentForwardwraps instatementReferencesLocal(classparser/decompiler/core/guarded_call_inline.go) and clean up dangling caught-exception expression discards (rewrite_var.go,try_rewriter.go) so regenerated enums lift withoutextends Enumfallbacks.Best-Effort Case-Fold Subdirectory Disambiguation & Bounded Parallel Export (
internal/filesys,classparser/jarwar,classparser/dumper.go)<dir>__case<n>/<base>preserving.javabasenames on case-insensitive filesystems, collect dump tasks deterministically, and parallelizeDumpToLocalFileSystemvia a bounded worker pool.class_context.SafeIdentifier.Sealed CI & Soundness Tests (
tools/requiredci,dex2jar,dex2jar/lower,classparser/...,internal/dexparser)-Xverify:allregression suites (wave1_soundness_test.go,wave2_soundness_test.go,wave3_soundness_test.go,r8_init_test.go,casefold_recover_test.go,stub_method_name_test.go,parser_recover_test.go, and core/rewriter tests), bumpedjavajive.Versionto"0.11.0", and updated sealed inventory hashes intools/requiredci/main.go.Real-World 8-APK / AAB Benchmark Scorecard (
v0.10.1Baseline ->v0.11.0, Temurin JDK 21-Xverify:all+android-34.jar)v0.10.1Baseline (Recover / StubC / VErr / Java)v0.11.0Result (Recover / StubC / VErr / Java / Stage B)bundletool-install-time.aab(3 DEX 037, 1,298 cls)complete/0/1/1298complete(Strict=true) /0/0/1298/35.562s(P1Err3522->3507)UnCrackable-Level1.apk(1 DEX 035, 7 cls)ERR(header SHA-1)partial/0/0/7/147msUnCrackable-Level2.apk(1 DEX 035, 625 cls)ERR(header SHA-1)partial/0/0/625/15.653s(P1Err=521(0))UnCrackable-Level3.apk(1 DEX 035, 1,396 cls)ERR(header SHA-1)partial/0/0/1396/40.991s(P1Err701->250)r2pay-v1.0.apk(1 DEX 035, 647 cls)ERR(header SHA-1)partial/0/0/647/25.194sNetGuard-v2.337-release.apk(1 DEX 035, 2,603 cls)ERR(orphan AnnotationDefault)partial/0/0/2603/1m3.588s(P1Err1141->754)NewPipe_v0.29.3.apk(3 DEX 035, 11,501 cls)partial/9709/0/11501partial/81/0(11490 ok, 11 missing_dep) /11501/9m28.171sKeePassDX-4.5.8-libre.apk(3 DEX 035, 18,278 cls)partial/1/10/8575(5m timeout)complete(Strict=true) /0/0(18256 ok, 22 missing_dep) /18278/8m35.222sVerifyError, 0ClassFormatError, 0IncompatibleClassChangeError, 7/8 real-world apps at 0 stubbed classes (NewPipereduced9,709 -> 81, 99.17% reduction), and 36,355/36,355 Java source files emitted cleanly without Stage B timeouts.Verification
git diff --checkgo vet ./...CGO_ENABLED=0 go build ./...andCGO_ENABLED=0 go build -tags javajive_full_jdk ./...go run ./tools/requiredci -check,-run contract,-run dex,-run algorithm,-run corpusgo test -count=1 . ./cmd/javajive&go run ./cmd/javajive version(javajive 0.11.0)JAVAJIVE_EXTERNAL_EVAL=1 go test -v -count=1 ./test/external(TestExternalJModAndJImageskipped withoutJAVAJIVE_JIMAGE_INTEGRATION=1)