Skip to content

Android reproducibility: authenticated release and deterministic input audits - #7043

Draft
antuz123 wants to merge 25 commits into
sprintfrom
codex/android-repro-independent-20261008
Draft

antuz123 wants to merge 25 commits into
sprintfrom
codex/android-repro-independent-20261008

Conversation

@antuz123

@antuz123 antuz123 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Establish the inputs and evidence needed for an independent Bitcoin Keeper Android released-binary comparison. This draft targets sprint and remains separate from R4 integration, Bitkey, and OSS Scanner enrollment. A release reproducibility verdict is not established.

Changes

  • Preserve the pinned Linux placeholder/debug APK/AAB diagnostic and strict Gradle checksum checks.
  • Add a passive source-input audit: configuration names, selected file fingerprints, Yarn integrity coverage, dynamic Gradle declarations, and static native-download checks. It never reads environment files.
  • Add bounded ZIP32 APK container inspection, including exact ZIP regions and signing-block pairs. SDK-metadata-only differences still return mismatch.
  • Check Realm 12.15.0's four Android OpenSSL 3.3.1 downloads by SHA-256 before extraction; reject unreviewed Android versions/ABIs.
  • Capture all downloaded apt archive hashes before an offline installation, record installed package versions, and retain safe input/container reports in diagnostic CI. No APK/AAB binaries are uploaded.
  • Record fresh authenticated-release evidence, actual emitted AGP version, prior CI results, and remaining release-comparison gaps in reproducibility/README.md.

Verification

At head c12dcdc:

  • All 49 focused Python tests pass locally; shell syntax and staged Git whitespace checks pass. Current focused CI also passes.
  • Locked patch-package 6.4.7 applies the Realm patch to the SRI-verified npm package. CMake 3.22.1 downloads/extracts all four real pinned archives; a wrong checksum fails before extraction, unknown version/ABI fails, and a non-Android fixture preserves prior behavior. The final whitespace-safe patch produces exactly the tested helper bytes.
  • The new apt stage passed in Docker with a transient proxy CA mount, TLS and APT signatures enabled: 23 downloaded archive hashes and 169 installed package versions recorded.
  • All four freshly downloaded v2.6.3 assets match GitHub's sizes/digests. Both PGP signatures verify against established fingerprint 389F4CADA0785AC0E28A0C181BEBDE261DC3CF62, also published in April 2024 repository documentation. APK SHA-256: a20d934ebd80ece779d3c171c7906bb4aff010337989ec1b826cab55c50eba46.
  • Android APK v2 verification passes; signer certificate SHA-256: bfa023d99facebafa4a9af22b9e49a13dbbfa3ee825be3da16cca9e3ea1b243a. Package io.hexawallet.bitcoinkeeper, version 2.6.3, code 626. The seven-field presence audit passes without disclosing values.
  • Released APK metadata reports AGP 8.12.0, also confirmed by prior diagnostic APK/AAB entry hashes. The source directly declares 8.8.0; declaration and resolved version are distinct.
  • A copied-release test fixture with one SDK-metadata byte flipped preserves payload hashes and APK v2 verification; the new container comparison correctly returns mismatch and identifies pair 0x504b4453. This is a tooling test, not a source rebuild.

The prior final-head Android run 37937333390 passed, contrary to the stale previous description: 1,096 tasks at checkout 94eb5a53a055e13eaff773f2b8af1551e4026a32, associated with former PR head 5a6a1ead6b14a9054c34de28bd2885458d576389. Its downloaded entry manifest matches same-source repeat run 37925672723 exactly: 1,610 APK entries and 1,698 AAB entries, manifest SHA-256 390ebdd7481de40ed7d0850a25e5de65ff69edd307507b4978b0a6416b128670. Whole AAB SHA-256 remains f08727ab342ef8a1b9740cbcdbaa3fc62ae2f0fb022cb06b40e2c78f970effc0. Previous controlled builds located APK byte variance solely in encrypted SDK metadata; retain that metadata.

Fresh Android integration run 38212939422 passed: all 1,096 tasks and APK/AAB, ZIP-entry, container, source-audit and apt/package manifest checks succeeded. It tested PR merge checkout 2133fd821c0f3322c8eb4920c5c51eb921b4b9e5, associated with head c12dcdc4a332110e22ca84a1e7f1dc832fd9fe37; record this source distinction when comparing local outputs. Current general Jest CI passed all 183 tests / 17 suites; focused tools and CodeQL also passed. The prior 30 Electrum failures did not recur in this run. Lint itself failed with 4,540 errors and 913 warnings, exactly the same counts as the former head; its job appears successful because the step has continue-on-error: true. This corrects the earlier job-status-based lint claim. The local-validation gate remains failing pending Mac validation. Linux Android integration passed; Mac/emulator validation remains outstanding and lint is not clean.

Remaining gaps and next steps

  1. Review the exact historical release configuration and source state. Both tagged/current sources consume 13 configuration names, six outside the provisional seven-name allowlist; react-native-config can embed additional supplied fields. The diagnostic branch also has a different lockfile and older Android version than v2.6.3. Do not use it as an exact-release candidate or publish unchecked production values.
  2. Lock/record resolved dependency versions and verify the remaining inputs. Gradle checksums remain an observed baseline rather than independent publisher authentication; five commit-pinned Yarn dependencies lack SRI. The Realm patch checks fresh downloads but an extracted-cache marker remains a bypass. Other native input paths need auditing.
  3. Build the exact release commit independently with reviewed release-equivalent inputs. The v2.6.3 tag/commit is unsigned, the release mutable, and embedded VCS metadata has no source SHA. No GitHub attestation was retrieved (API 404).
  4. Obtain fresh authenticated complete Play split evidence and compare corresponding output from the rebuilt AAB, recording bundletool/device/signing inputs. No AAB is published for v2.6.3 and no Play identity is configured here. Earlier Play/GitHub code parity is historical channel evidence, not independent reproduction.
  5. Complete an actual end-to-end release recipe before producing a WalletScrutiny build.sh --binary / COMPARISON_RESULTS.yaml verdict.

No production signing, credentials/configuration values committed, release publication, or merge performed. Release inclusion in R4/R5 remains undecided; overlapping R4 files require separate coordination.

Codex local handoff

State: NEEDS_LOCAL
PR: #7043
Base: sprint
Head branch: codex/android-repro-independent-20261008
Head commit: c12dcdc
Goal and acceptance criteria: Validate Android build-input/inspection changes and exact-source comparisons while preserving the not-established release verdict. A placeholder/debug build may validate tooling only.
Changes made: Realm native archive verification; source-input audit; APK container/signing-block inspection; apt dependency evidence and CI retention; authenticated v2.6.3 evidence.
Cloud checks: 49 focused Python tests PASS; shell syntax PASS; staged git diff --check PASS; patch-package 6.4.7 application PASS; CMake 3.22.1 four real ABI downloads/extractions and rejection controls PASS; Docker apt stage PASS; release PGP/checksum/APK-v2/field-presence checks PASS. Current focused CI PASS, general Jest CI PASS (183 tests / 17 suites), CodeQL PASS. Lint command FAIL (4,540 errors / 913 warnings, same as former head, masked by continue-on-error). Fresh Linux APK/AAB CI PASS (run 38212939422, 1,096 tasks plus every output manifest check; checkout 2133fd8 associated with this head). No Mac native build, emulator install, or physical-device test performed.
Required local checks: ANDROID
Local checks requested: Fetch this exact head into a clean isolated checkout. Run the focused Python suite and a clean pinned Android production-flavor APK/AAB diagnostic; verify all retained manifests, SDK metadata scope, and Realm fresh-download checks. Build/install the Android diagnostic on an emulator and smoke-test startup/onboarding with disposable data, recording the invalid-service limitations. For a release comparison, first obtain the reviewed historical input contract; use exact tag 872cbc4 and independently authenticated binaries, not the sprint diagnostic. iOS and hardware checks are not requested because this continuation changes Android build/inspection tools only; report any device tests actually performed.
Risks / known gaps: Historical production configuration unresolved; released source association not attested; dependency resolution/remaining native caches incomplete; no fresh Play split comparison or release AAB; Mac/emulator validation outstanding; lint failures unchanged from the former head. Prior Electrum failures did not recur in current Jest CI. No reproducibility verdict or release approval. Do not merge, production-sign, upload, or publish.

antuz123 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Downstream build consumer: the OSS Scanner preparation is now in #7044. It should reuse this work, not introduce a second Android toolchain. Enrolment does not need a final WalletScrutiny verdict, the full R4 release, or completion of the separate recoverable-wallet preview.

One concrete source mismatch at the inspected head cc15f593b62689267168a2405b318876c91947e0: reproducibility/android-diagnostic-in-container.sh unconditionally reads require('./release/version.json').version and .androidVersionCode after building, but release/version.json is absent at that exact revision. The check cannot complete as written even if the earlier build succeeds. Please resolve the manifest/source alignment within this build workstream; do not substitute guessed release values.

For the scanner handoff, the minimum needed is the reviewed, complete Docker build plus a real network-disabled test run with required sources, caches and synthetic config retained in the image. The current toolchain-only Dockerfile needs a small build adapter preserving Anthropic's /src checkout contract. #7044 records these gates. No release merge, additional production scope or schedule change is requested.

Copy link
Copy Markdown
Collaborator Author

Codex Cloud continuation handoff

State: Ready for Cloud continuation. Draft diagnostic work; no WalletScrutiny verdict or release approval.

Workstream and objective: Android app reproducibility for Bitcoin Keeper. Establish a repeatable, independently inspectable Android build and ultimately compare an exact public release build with its distributed APK and Play splits. Keep this work parallel to R4/2.6.4 and Bitkey.

Repository and baseline (12 Oct 2026): KeeperCommunity/bitcoin-keeper. Primary draft PR #7043 targets sprint from branch codex/android-repro-independent-20261008. Exact remote and local head: 5a6a1ea. The worktree is clean, with zero commits ahead of or behind its remote. Latest sprint is 6c4e1db; its only subsequent change relevant to this PR is the new root AGENTS.md workflow contract. No newer Cloud commit or source conflict was found on #7043. Read that AGENTS.md before continuing.

A separate old-base Android live-config experiment was preserved on remote branch codex/android-repro-release-env-fix-20261009, exact commit 8e29407. It has no PR. It is superseded by the stronger reviewed .env.production guard in R4 draft #7045; do not merge or cherry-pick it into #7043. Other local reproducibility experiments have their intended content in #7043 or are on the already-pushed verification-bootstrap branch. Generated APKs, caches, logs, and private configuration remain outside GitHub.

Completed

  • Added a Linux Android diagnostic build for production-flavor APK and AAB using placeholder service values and a disposable debug key. Pinned the JDK base image, Node, Yarn, Android SDK archives/revisions, both NDKs, CMake, and an Ubuntu apt snapshot; removed mutable Maven-local lookup.
  • Added strict Gradle artifact checksum metadata, input/configuration checks, APK value auditing without exposing values, focused tests, and CI entry-hash manifests.
  • Verified that the authenticated public v2.6.3 APK contains the seven proposed noncredential build fields. This does not establish the complete historical production configuration.
  • Two clean runs at exact source commit 594397e produced identical content and sizes for all 1,610 APK entries and 1,698 AAB entries; the AAB whole-file hash also matched. Controlled APK inspection found the only whole-file byte difference in Google's encrypted SDK dependency metadata pair 0x504b4453 (15,481 differing bytes). Retain this Play metadata; do not claim byte-identical APKs or a distributed-binary match.
  • The old Prepare Bitcoin Keeper for Anthropic OSS Scanner #7044 comment about a missing release/version.json applied to an earlier head. The current diagnostic reads built APK output metadata instead, and its current-head Android run passed.

Partially implemented / remaining

  • The seven-name future input allowlist is provisional; the current sprint app still reads 13 configuration names. Review the exact chosen release source and the actual consumed, reviewed production configuration without committing or logging values. Release inclusion in R4 versus R5 has not been decided.
  • The diagnostic build uses placeholders and a debug key. It has not rebuilt or compared any distributed release APK or Play-generated split. Gradle checksums came from a first clean build rather than independent publisher authentication; transitive native downloads and all resolved apt dependency hashes remain to be pinned or accounted for.
  • There is no WalletScrutiny-compatible build.sh accepting --binary and no adjacent COMPARISON_RESULTS.yaml yet. The published v2.6.3 binary showed historical Node/path and native-output differences documented in reproducibility/README.md; do not infer a source match from the current diagnostic.
  • The PR README still describes the final-head Android run as in progress; the run has since passed. Update the record when doing the next Cloud edit.

Actual checks and known failures

Dependencies and decisions to preserve

Next Codex Cloud tasks, in priority order

  1. Read latest sprint AGENTS.md and compare fresh heads of Android reproducibility: authenticated release and deterministic input audits #7043, R4: 2.6.4 mobile integration and release-readiness candidate #7045, R4: Prepare Android build verification; stop USDT setup, sends and trading #7035, and Prepare Bitcoin Keeper for Anthropic OSS Scanner #7044. Refresh Android reproducibility: authenticated release and deterministic input audits #7043's verification text to reflect the passed final-head Android run; preserve the separate workstream boundaries.
  2. Resolve the candidate release's full configuration-input and source-version contract (13 current names versus seven proposed), without exposing values. Document the exact reviewed source/config fingerprint and remaining unpinned apt/native inputs. Tighten only the build inputs required for an independent replay.
  3. Produce and test a WalletScrutiny-compatible build.sh / COMPARISON_RESULTS.yaml workflow against the selected release, accepting --binary. Build its exact source with reviewed release-equivalent inputs, compare with authenticated GitHub APK and Play splits, and investigate each content mismatch and the known encrypted metadata difference. Record actual results; a diagnostic repeat alone is insufficient.
  4. Coordinate Prepare Bitcoin Keeper for Anthropic OSS Scanner #7044 as a consumer of the reviewed build environment. Resolve the Electrum CI gate with its owning R4 workstream or document a verified isolation; avoid importing unrelated R4 fixes into Android reproducibility: authenticated release and deterministic input audits #7043.

Restrictions: No merge to sprint or release branch, no store submission, deployment, signing with production keys, or release publication without explicit user approval. Do not reset, clean, force-push, overwrite another stream, or commit secrets/generated artifacts. When development is complete, add the repository AGENTS.md “Codex local handoff” section with exact head SHA and targeted Mac checks, then return PR #7043 in NEEDS_LOCAL state for ChatGPT coordination.

@antuz123 antuz123 changed the title Android reproducibility: independent diagnostic build and APK input audit Android reproducibility: authenticated release and deterministic input audits Oct 12, 2026

This branch has not been deployed

No deployments
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