release: reproducible builds, and sign every asset
"The source is public" is not a check anyone can run, and against a Tor + Monero tool the surviving objection is that the released binary might not be that source. This makes the build checkable instead of trusted. - scripts/reproducible-build.sh is the single definition of a release build: digest-pinned builder image, fixed in-container paths, SOURCE_DATE_EPOCH from the released commit, --locked, its own apt build deps, and RUSTFLAGS replaced rather than extended. The fixed paths are load-bearing: rustc's --remap-path-prefix cannot reach absolute paths compiled in by a C toolchain, and this graph always has one (rusqlite compiles OpenSSL from vendored sources; the default cuprate-daemon adds RandomX and cmake). It also records toolchain versions in build-info, because the apt build deps are not digest-pinned the way the image is. - release.yml pins the image by digest, resolves SOURCE_DATE_EPOCH from the tag's commit, runs that recipe, and uploads build-info-<target>.txt beside the binary. The cargo target volume is created per run and removed, so the published artifact cannot come out of a cache that a verifier does not have. - scripts/verify-reproducible.sh rebuilds a tag in the same pinned image and compares bytes against the release asset. Two fresh builds of the same tree in that image produce identical sha256. - scripts/sign-release.sh signs with minisign and verifies its own signature against the committed public key. The publish job signs BEFORE publishing and fails closed without MINISIGN_SECRET_KEY, so nothing unsigned reaches the release page: an unsigned release is indistinguishable from a signed one to anyone who is not checking. Checked: signature accepted by an independent minisign -V, a tampered file rejected, a missing key refused, a missing public key refused. - build-release-local.sh runs the same container and the same recipe. A host cargo build would publish a hash nobody could reproduce, which is worse than having no fallback at all. - docs/VERIFY.md is the verifier-facing walkthrough: the dependency graph and where its HTTP actually comes from, the wallet's real seed-read exposure, the rebuild check, the signature check, and an explicit list of what none of it proves. - Cargo.toml repository: point at the Forgejo instance that hosts this and builds its releases. Needs a MINISIGN_SECRET_KEY secret before the next release; without it the publish job stops by design. docs/RELEASING.md has the keygen procedure.
This commit is contained in:
parent
1031092192
commit
601f640f78
11 changed files with 962 additions and 76 deletions
|
|
@ -45,9 +45,31 @@ created if the build or publish fails", and the dry-run path.
|
|||
The Linux binaries land first; the APK build is the long pole.
|
||||
6. **Check the assets.** Open the release page (or
|
||||
`GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>`) and require a
|
||||
non-zero `size` for every asset: the two Linux binaries + `.sha256`, the
|
||||
APK + `.sha256`, the AAR + `.sha256`. A green run is not proof — the Pi
|
||||
runner hairpins through Cloudflare and has uploaded 0-byte assets before.
|
||||
non-zero `size` for every asset. A Linux release is **eleven** assets:
|
||||
|
||||
| asset | what it is |
|
||||
|---|---|
|
||||
| `onionwire-<target>` ×2 | the two Linux binaries |
|
||||
| `onionwire-<target>.sha256` ×2 | their checksums |
|
||||
| `onionwire-<target>.minisig` ×2 | the binary signatures |
|
||||
| `onionwire-<target>.sha256.minisig` ×2 | the checksum signatures |
|
||||
| `build-info-<target>.txt` ×2 | the recipe record (commit, epoch, toolchain, image digest) |
|
||||
| `onionwire-signing.pub` | the public half of the signing key |
|
||||
|
||||
plus the APK + `.sha256` and the AAR + `.sha256` attached by `android-release`.
|
||||
A green run is not proof — the Pi runner hairpins through Cloudflare and has
|
||||
uploaded 0-byte assets before.
|
||||
|
||||
7. **Spot-check reproducibility.** On any machine with docker and a clone:
|
||||
|
||||
```bash
|
||||
scripts/verify-reproducible.sh <tag>
|
||||
```
|
||||
|
||||
It has to print `RESULT: MATCH`. A `MISMATCH` means the published binary is
|
||||
not what this tag builds to — release-blocking, not cosmetic. Diagnose with
|
||||
the `build-info-<target>.txt` on the release before assuming compromise:
|
||||
a different commit or a moved image digest explains most mismatches.
|
||||
|
||||
## Inputs
|
||||
|
||||
|
|
@ -75,9 +97,18 @@ Contradictory input is rejected, never guessed at:
|
|||
and fails. `201` means created; `409` means it was created concurrently and
|
||||
this run joins it.
|
||||
|
||||
`aarch64` (Pi runner) and `x86_64` (amd64 runner) jobs build the binary in a
|
||||
`rust:*-bookworm` container, strip it, refuse an empty binary, write the
|
||||
`.sha256`, and upload it as an artifact.
|
||||
`aarch64` (Pi runner) and `x86_64` (amd64 runner) jobs run
|
||||
`scripts/reproducible-build.sh` inside the **digest-pinned** builder image
|
||||
(`RUST_IMAGE` in the workflow). That script owns the whole build: `--locked`,
|
||||
fixed in-container paths, `SOURCE_DATE_EPOCH` from the released commit, the
|
||||
`--remap-path-prefix` set, `strip --strip-all`, the `.sha256`, and the
|
||||
`build-info-<target>.txt` record. The job then only refuses a half-made dist and
|
||||
uploads it — the target volume is created per run and removed afterwards, so the
|
||||
published binary cannot come out of a cache a verifier does not have.
|
||||
|
||||
The `SOURCE_DATE_EPOCH` step reads the committer time of
|
||||
`needs.version.outputs.sha`. It is deliberately not "now": a rebuild of this tag
|
||||
in six months has to hand the compiler the same epoch CI handed it.
|
||||
|
||||
`publish` job (Pi runner) downloads both artifacts, refuses any empty file,
|
||||
and calls `scripts/publish-release.sh` to create-or-update the release with all
|
||||
|
|
@ -168,6 +199,57 @@ Never move or delete a published `v*.*.*` tag by hand, and never create one by
|
|||
hand: a hand-pushed tag starts nothing (`release.yml` has no tag-push trigger),
|
||||
and `release.yml` will refuse to move a tag that exists on another commit.
|
||||
|
||||
## Reproducibility and signing
|
||||
|
||||
Two properties a download can be checked against, and one prerequisite that no
|
||||
one else can do for you.
|
||||
|
||||
### The recipe
|
||||
|
||||
`scripts/reproducible-build.sh` is the single definition of a release build.
|
||||
Everything that can move the output bytes is pinned inside it:
|
||||
|
||||
- the **builder image, by digest**. `rust:1.98-bookworm` floats, and a rustc
|
||||
patch release changes codegen. The digest must be identical in three files —
|
||||
`RUST_IMAGE` in `.forgejo/workflows/release.yml`, and `BUILDER_IMAGE` in both
|
||||
`scripts/verify-reproducible.sh` and `scripts/build-release-local.sh`. Bump all
|
||||
three in **one** commit, and expect the hashes to change: that is a toolchain
|
||||
change, not a compromise.
|
||||
- **fixed absolute paths**, because rustc's `--remap-path-prefix` cannot reach
|
||||
absolute paths compiled in by a C toolchain, and this crate always has one:
|
||||
`rusqlite`'s `bundled-sqlcipher-vendored-openssl` compiles OpenSSL from source
|
||||
and OpenSSL bakes its build paths into the artifact.
|
||||
- **`SOURCE_DATE_EPOCH`** from the released commit's committer date.
|
||||
- **`--locked`**, and `RUSTFLAGS` is replaced rather than extended so an ambient
|
||||
profile setting cannot silently change the bytes.
|
||||
|
||||
### The signing key (one-time, yours to hold)
|
||||
|
||||
```bash
|
||||
minisign -G -W -p scripts/onionwire-signing.pub -s onionwire-signing.key
|
||||
```
|
||||
|
||||
`-W` keeps the secret key unencrypted, because CI cannot answer a prompt and a
|
||||
passphrase stored beside the key protects nothing. Then commit the `.pub`, add
|
||||
the `.key` file's **contents** as the Actions secret `MINISIGN_SECRET_KEY`, and
|
||||
delete the `.key` from your machine.
|
||||
|
||||
**Until that secret exists, releases fail.** The signing step runs *before*
|
||||
publish and exits non-zero without a key, so nothing unsigned reaches the
|
||||
release page. That is deliberate: an unsigned release is indistinguishable from
|
||||
a signed one to anyone who is not checking, which makes it worse than no release.
|
||||
|
||||
`scripts/sign-release.sh` also verifies each signature it just made against the
|
||||
committed public key before returning, so a broken key fails at signing rather
|
||||
than after the assets are public.
|
||||
|
||||
### The local fallback
|
||||
|
||||
`scripts/build-release-local.sh` runs the same pinned container and the same
|
||||
recipe, and requires `MINISIGN_SECRET_KEY` too. It is a fallback for a dead
|
||||
runner, not a way to ship something the verifier cannot reproduce — a host
|
||||
`cargo build` would produce a binary whose hash no one could match.
|
||||
|
||||
## Version policy
|
||||
|
||||
`MAJOR.MINOR.PATCH` on the tag (`v`-prefixed). The default bump is `minor`: a
|
||||
|
|
|
|||
Loading…
Reference in a new issue