Skip to content

Conversation

@0xh3rman
Copy link
Contributor

@0xh3rman 0xh3rman commented Nov 13, 2025

Summary

This PR adds reproducible build verification infrastructure to enable independent auditors and researchers to verify that published APKs match the source code. It implements Gradle dependency verification, a Docker-based verification script, and optimized tooling for maintaining verification metadata.

Key Changes

🔐 Gradle Dependency Verification

  • Enabled dependencyLocking.lockAllConfigurations() for all projects
  • Generated gradle/verification-metadata.xml with SHA-256 checksums for all dependencies

🐳 Reproducible Build Verification

  • Added scripts/verify_apk.sh - a Docker-based script to rebuild and verify APKs
  • Supports rebuilding any git tag in a clean Docker environment
  • Generates diffoscope reports to analyze byte-level differences
  • Configurable via environment variables (VERIFY_GRADLE_TASK, VERIFY_APK_SUBDIR, etc.)

⚡ Optimized Verification Metadata Generation

  • Added just generate-verification-metadata task that:
    • Uses debug builds instead of release builds (faster)
    • Runs in Docker for Linux artifact generation
    • Automatically reads GitHub credentials from local.properties
    • No manual environment variable setup required

📚 Documentation

  • Added "Reproducible Release Verification" section to README.md
  • Provided clear usage examples with specific version (v1.3.48)
  • Documented all configuration options and environment variables

🛠️ Code Quality

  • Refactored verify_apk.sh with main function for better readability
  • Organized into logical sections (Helper Functions, Docker Build, Diffoscope Report)
  • Improved function signatures with explicit parameters
  • Added inline comments for clarity

Verification Example

# Download official APK
curl -L --fail -o official.apk http://apk.gemwallet.com/gem_wallet_universal_v1.3.48.apk

# Verify it matches the source code
./scripts/verify_apk.sh v1.3.48 official.apk

Benefits

  • Transparency: Anyone can verify that published APKs match the source code
  • Security: Dependency checksums prevent supply chain attacks
  • Reproducibility: Builds are deterministic and verifiable in isolated environments
  • Trust: Users and auditors can independently verify app integrity

Testing

  • ✅ Generated complete verification-metadata.xml for all platforms
  • ✅ Docker build produces identical APKs
  • ✅ diffoscope reports work correctly for mismatch analysis

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @0xh3rman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust mechanism to ensure the reproducibility of the Android application's builds. By providing a script and documentation, it empowers users to independently verify that the publicly distributed APKs are byte-for-byte identical to those built from the source code, thereby enhancing transparency and trust in the release process.

Highlights

  • Reproducible Build Verification Script: A new shell script, scripts/verify_apk.sh, has been added to automate the process of verifying reproducible builds for the Android application. This script builds the APK within a Docker environment, extracts the universal APK, downloads the official APK from apk.gemwallet.com, and compares their SHA-256 hashes and raw bytes.
  • Documentation Update: The README.md file has been updated with a new section titled 'Reproducible Release Verification'. This section provides detailed instructions on how to use the verify_apk.sh script, including its purpose, steps, and available command-line options for customization.
  • Git Ignore Configuration: The .gitignore file has been updated to include artifacts/, ensuring that the output directory for the reproducible build verification process (which stores rebuilt and official APKs) is not committed to the repository.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/docker.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a robust mechanism for reproducible build verification, which is a great addition for transparency and security. The new verify_apk.sh script is well-structured, using Docker to create a consistent build environment and then comparing the locally built APK with the official one. The documentation in README.md is clear and provides good examples. I have one suggestion to improve the clarity of a command-line option in the script.

Enhances GitHub Actions workflows and Dockerfiles for better build caching and performance. Adds cache steps for NDK and AVD in CI, switches to setup-just action, and optimizes Docker buildx usage and cache sharing in docker.yml. Updates Dockerfile.base and Dockerfile.app to use Dockerfile 1.4 syntax, cache mounts for dependencies, and more efficient SDK installation. justfile updated to enable BuildKit for Docker builds.
@0xh3rman 0xh3rman merged commit 2729ec9 into main Nov 13, 2025
4 checks passed
@0xh3rman 0xh3rman deleted the reproducible-build-verification branch November 13, 2025 14:31
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.

3 participants