Skip to content

F-Droid 配布 APK のソース照合と再現ビルド検証 / Verify F-Droid release sources and builds - #1295

Merged
KazumaProject merged 3 commits into
devfrom
codex/fdroid-reproducible-build
Nov 12, 2026
Merged

KazumaProject merged 3 commits into
devfrom
codex/fdroid-reproducible-build

Conversation

@KazumaProject

@KazumaProject KazumaProject commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Refs #1293

日本語

v1.7.149(versionCode 844)の配布 APK と、タグから再ビルドするソースが異なるため、F-Droid の再現ビルド比較が失敗しています。実際にダウンロードした app-liteFdroid-release.apk のリビジョンは cb4b8006、Issue の再ビルド側は f9bef456、調査時点の公開タグは b8ce510e でした。

三段フリック非公開化に伴う履歴整理後に、タグと配布 APK の対応が崩れています。配布 DEX に存在する TfbiStickyFlickController などは再ビルド側のソースで削除されており、メタデータだけの差ではありません。比較した両コミットの AI 関連ソースに差分はなく、AI ネイティブランタイムは Full 専用依存で、Lite の配布 APK にはネイティブライブラリがありません。元の障害が Gradle キャッシュ破損によるものかは未確認です。

変更

  • checkout をワークフローのコミット SHA に固定します。
  • F-Droid 用 APK を別々の新規 checkout・空の Gradle user home で 2 回生成し、ビルドキャッシュ・設定キャッシュを使用しません。
  • F-Droid と同じ release バリアントを署名設定なしでビルドします。releaseUnsigned は BuildConfig.BUILD_TYPE が異なるため使用しません。
  • 未署名 APK のバイト単位の一致を確認した後、既存と同じ v2 方式で署名します。
  • 公開前に全 APK の Git リビジョンと公開タグを照合します。リビジョン欠落・不一致・タグ移動を拒否し、既存リリースのアセットも置換しません。
  • 手動実行でもビルド比較と APK リビジョン照合を行います。公開はタグ実行に限定します。

検証

  • リリース検証の unittest 12 件成功(追加 8 件、既存 4 件)。
  • actionlint 成功。
  • 配布済み APK を使い、Issue の SHA および現在の公開タグとの不一致で停止することを確認。
  • macOS の別々の通常クローンで dev 691e2784 の assembleLiteFdroidRelease が 2 回成功。片方は空の Gradle user home、もう片方は既存の依存キャッシュを使用し、両方ともビルド・設定キャッシュは無効化。両 APK のリビジョン照合も成功。
  • zipalign、検証用キーによる v2 署名、apksigner verify、署名後のリビジョン照合が成功。
  • 2 つの未署名 APK は cmp で完全一致。両方の SHA-256 は f3d1acfebb4e4db6ef903c286472c3d658cdabd2c5a80f61ef7f61a31aefe481。
  • GitHub Actions のワークフロー全体と F-Droid サーバー側の再検証は未実施です。

既存の v1.7.149 のタグ・APK・リリースは変更していません。配布 APK とソースを一致させるには、新しいバージョン・versionCode・タグでのリリースが必要です。公開後に手動でタグを移動する操作はこの CI では防げないため、公開済みタグは固定してください。Issue #1293 は open のまま維持します。

変更はリリース設定・検証コード・直接関係するテストの 3 ファイルのみです。APK・ログ・調査用ファイルはコミットに含めていません。

English

F-Droid cannot reproduce v1.7.149 (versionCode 844) because the distributed APK and tagged source refer to different revisions. The downloaded Lite F-Droid APK embeds cb4b8006; the issue reports a rebuild of f9bef456, while the public tag pointed to b8ce510e during this investigation.

The tag/APK relationship diverged after the public-history cleanup associated with retiring three-stage flick input. Classes such as TfbiStickyFlickController remain in the distributed DEX but were removed from the rebuild source, so changing revision metadata alone would not resolve the mismatch. The compared revisions have no AI-source changes, and the AI native runtimes are Full-only dependencies. Corrupted Gradle caches have not been established as the original cause.

Changes

  • Pin checkouts to the workflow commit.
  • Build the unsigned F-Droid release variant twice in independent clean checkouts with empty Gradle user homes and both build/configuration caches disabled.
  • Require byte-identical unsigned APKs before signing the verified output with the existing v2-only scheme. Avoid releaseUnsigned, which changes BuildConfig.BUILD_TYPE.
  • Check every APK's source revision and the current public tag before publication. Reject missing/mismatched revisions, moved tags, and replacement of existing release assets.
  • Run build comparison and APK revision checks for manual runs as well; publish only tag runs.

Validation

  • All 12 release-verification unit tests pass (8 new, 4 existing); actionlint passes.
  • The guard rejects the actual distributed APK against both the issue's rebuild SHA and the current public tag.
  • Two separate regular macOS clones of dev 691e2784 successfully build assembleLiteFdroidRelease. One uses an empty Gradle user home; the other reuses the dependency cache. Both disable build/configuration caches, and both APK revision checks pass.
  • Alignment, disposable-key v2 signing, signature verification, and post-signing revision verification pass.
  • The two unsigned APKs are byte-identical (cmp), both with SHA-256 f3d1acfebb4e4db6ef903c286472c3d658cdabd2c5a80f61ef7f61a31aefe481.
  • The complete GitHub Actions workflow and F-Droid server-side verification have not been run.

This PR leaves the existing v1.7.149 tag, APKs, and release untouched. A new version, versionCode, and tag are required to distribute matching source and binaries. CI cannot prevent manual tag movement after publication; published tags must remain fixed. Issue #1293 remains open.

Only release configuration, verification code, and directly related tests are included (3 files). No APKs, logs, or investigation artifacts are committed.

追加修正 / Additional signing verification

  • Build Tools 36 の署名処理に --alignment-preserved true を追加し、署名前の ZIP 整列情報を保持します。
  • 公開前に apksigcopier==1.1.1 で署名済み APK と独立再ビルドした未署名 APK を比較します。通常の apksigner verify だけでなく、F-Droid の署名コピー方式でも検証します。
  • Full・Lite の署名付き AAB をタグ実行でも CI 成果物として保存します。
  • dev 691e2784 の既存検証 APK と独立ビルドを使い、従来の署名では署名コピー比較が失敗し、整列保持を指定した検証鍵での署名では成功することを確認しました。新リリースの成果物と F-Droid 公式サーバー側の結果は未確認です。
  • リリース検証 unittest 12 件、actionlint、git diff --check が成功しています。

@KazumaProject
KazumaProject merged commit 22927dc into dev Nov 12, 2026
1 check passed
@KazumaProject
KazumaProject deleted the codex/fdroid-reproducible-build branch November 12, 2026 17:58
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.

1 participant