Compare commits

..
11 changed files with 76 additions and 962 deletions

View file

@ -47,18 +47,7 @@ env:
CARGO_TERM_COLOR: never
# Same floor as ci.yml: the release binary has `cuprate-daemon` on by default,
# and `tapes` does not build on 1.91 (`VecDeque::pop_front_if`, stable in 1.93).
# Pinned by DIGEST, not by tag. `rust:1.98-bookworm` floats: a rustc patch
# release changes codegen and therefore every published hash — which turns a
# routine toolchain bump into an unexplainable reproducibility mismatch for
# anyone verifying an old release. rustc in this digest is 1.98.1
# (48a229cea), LLVM 21.1.2, host x86_64-unknown-linux-gnu. 1.98 is the floor
# for the default feature set (see Cargo.toml rust-version).
#
# This digest IS the release recipe, and it must match BUILDER_IMAGE in
# scripts/verify-reproducible.sh and scripts/build-release-local.sh. If they
# disagree, a verifier rebuilds with a different toolchain than CI shipped and
# reports a false mismatch. Bump all of them in one commit — docs/VERIFY.md.
RUST_IMAGE: rust@sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e
RUST_IMAGE: rust:1.98-bookworm
# Not baking pkg-config/libssl-dev into a custom image on this card —
# dind PVC would make that the durable fix for the apt loop. Filed separately.
CARGO_REGISTRY_VOLUME: onionwire-cargo-registry
@ -202,10 +191,7 @@ jobs:
timeout-minutes: 120
env:
TARGET: aarch64-unknown-linux-gnu
# Per-run, and removed at the end of the job: a reused target dir lets the
# published binary come out of cached artifacts, which is precisely what a
# verifier rebuilding from an empty directory cannot reproduce.
CARGO_TARGET_VOLUME: onionwire-target-release-${{ github.run_id }}-aarch64
CARGO_TARGET_VOLUME: onionwire-target-aarch64
BUILD_CONTAINER: onionwire-release-${{ github.run_id }}-aarch64
steps:
- name: Checkout source
@ -216,76 +202,48 @@ jobs:
- name: Show runner arch
run: uname -m && echo "target=$TARGET"
- name: Resolve SOURCE_DATE_EPOCH from the released commit
id: epoch
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
# The released commit's committer time, not "now". A rebuild of this
# tag in six months has to hand the compiler the same epoch CI handed
# it, or the two builds cannot match and every verification is noise.
epoch=$(git log -1 --format=%ct "${{ needs.version.outputs.sha }}")
case "$epoch" in
''|*[!0-9]*) echo "could not read a commit time for ${{ needs.version.outputs.sha }}" >&2; exit 1 ;;
esac
echo "epoch=$epoch" >> "$GITHUB_OUTPUT"
echo "SOURCE_DATE_EPOCH=$epoch"
- name: Build ${{ env.TARGET }} in the pinned rust container
env:
SOURCE_DATE_EPOCH: ${{ steps.epoch.outputs.epoch }}
RELEASE_SHA: ${{ needs.version.outputs.sha }}
- name: Build ${{ env.TARGET }} in a rust container
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
echo "workspace: $GITHUB_WORKSPACE"
docker volume create "$CARGO_REGISTRY_VOLUME" > /dev/null
# Fresh per run (see the job env): the published artifact has to be
# reproducible from an empty target dir, so it is not allowed to come
# out of a cache that a verifier does not have.
docker volume create "$CARGO_TARGET_VOLUME" > /dev/null
docker rm -f "$BUILD_CONTAINER" > /dev/null 2>&1 || true
docker create --name "$BUILD_CONTAINER" -i \
-e CARGO_TARGET_DIR=/target \
-e CARGO_BUILD_JOBS=2 \
-e CARGO_TERM_COLOR=never \
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
-e BUILDER_IMAGE="$RUST_IMAGE" \
-e TARGET_TRIPLE="$TARGET" \
-e GIT_SHA="$RELEASE_SHA" \
-e OUT=/out \
-v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \
-v "$CARGO_TARGET_VOLUME":/target \
-w /src \
"$RUST_IMAGE" \
sh -euxc 'mkdir -p /src /out && tar xzf - -C /src && cd /src && bash /src/scripts/reproducible-build.sh'
sh -euxc 'mkdir -p /src && tar xzf - -C /src && cd /src \
&& apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true update \
&& apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev cmake build-essential \
&& cargo build --release --locked \
&& strip /target/release/onionwire \
&& ls -l /target/release/onionwire'
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees \
--exclude=./.ci-tools . \
| docker start -a -i "$BUILD_CONTAINER"
mkdir -p dist
# The recipe writes the stripped binary, its .sha256 and the build-info
# record into /out, and installs its own apt build deps — the caller
# supplies only the source tree and the pinned epoch.
docker cp "$BUILD_CONTAINER:/out/." dist/
docker cp "$BUILD_CONTAINER:/target/release/onionwire" "dist/onionwire-$TARGET"
docker rm -f "$BUILD_CONTAINER" > /dev/null
docker volume rm "$CARGO_TARGET_VOLUME" > /dev/null
- name: Verify the recipe's dist output
- name: Pack and checksum
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}/dist"
ls -l
# scripts/reproducible-build.sh owns the checksum and the build-info
# record. This step only refuses to hand a half-made dist to publish.
for f in "onionwire-$TARGET" "onionwire-$TARGET.sha256" "build-info-$TARGET.txt"; do
if [ ! -s "$f" ]; then
echo "missing or empty dist asset: $f" >&2
bytes=$(wc -c < "onionwire-$TARGET")
if [ "$bytes" -eq 0 ]; then
echo "refusing empty binary onionwire-$TARGET" >&2
exit 1
fi
done
sha256sum -c "onionwire-$TARGET.sha256"
file "onionwire-$TARGET"
cat "build-info-$TARGET.txt"
sha256sum "onionwire-$TARGET" > "onionwire-$TARGET.sha256"
sha256sum -c "onionwire-$TARGET.sha256"
ls -l
- name: Upload dist artifact
uses: https://code.forgejo.org/actions/upload-artifact@v3
@ -301,10 +259,7 @@ jobs:
timeout-minutes: 120
env:
TARGET: x86_64-unknown-linux-gnu
# Per-run, and removed at the end of the job: a reused target dir lets the
# published binary come out of cached artifacts, which is precisely what a
# verifier rebuilding from an empty directory cannot reproduce.
CARGO_TARGET_VOLUME: onionwire-target-release-${{ github.run_id }}-x86_64
CARGO_TARGET_VOLUME: onionwire-target-x86_64
BUILD_CONTAINER: onionwire-release-${{ github.run_id }}-x86_64
steps:
- name: Checkout source
@ -330,76 +285,48 @@ jobs:
exit 1
fi
- name: Resolve SOURCE_DATE_EPOCH from the released commit
id: epoch
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
# The released commit's committer time, not "now". A rebuild of this
# tag in six months has to hand the compiler the same epoch CI handed
# it, or the two builds cannot match and every verification is noise.
epoch=$(git log -1 --format=%ct "${{ needs.version.outputs.sha }}")
case "$epoch" in
''|*[!0-9]*) echo "could not read a commit time for ${{ needs.version.outputs.sha }}" >&2; exit 1 ;;
esac
echo "epoch=$epoch" >> "$GITHUB_OUTPUT"
echo "SOURCE_DATE_EPOCH=$epoch"
- name: Build ${{ env.TARGET }} in the pinned rust container
env:
SOURCE_DATE_EPOCH: ${{ steps.epoch.outputs.epoch }}
RELEASE_SHA: ${{ needs.version.outputs.sha }}
- name: Build ${{ env.TARGET }} in a rust container
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
echo "workspace: $GITHUB_WORKSPACE"
docker volume create "$CARGO_REGISTRY_VOLUME" > /dev/null
# Fresh per run (see the job env): the published artifact has to be
# reproducible from an empty target dir, so it is not allowed to come
# out of a cache that a verifier does not have.
docker volume create "$CARGO_TARGET_VOLUME" > /dev/null
docker rm -f "$BUILD_CONTAINER" > /dev/null 2>&1 || true
docker create --name "$BUILD_CONTAINER" -i \
-e CARGO_TARGET_DIR=/target \
-e CARGO_BUILD_JOBS=2 \
-e CARGO_TERM_COLOR=never \
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
-e BUILDER_IMAGE="$RUST_IMAGE" \
-e TARGET_TRIPLE="$TARGET" \
-e GIT_SHA="$RELEASE_SHA" \
-e OUT=/out \
-v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \
-v "$CARGO_TARGET_VOLUME":/target \
-w /src \
"$RUST_IMAGE" \
sh -euxc 'mkdir -p /src /out && tar xzf - -C /src && cd /src && bash /src/scripts/reproducible-build.sh'
sh -euxc 'mkdir -p /src && tar xzf - -C /src && cd /src \
&& apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true update \
&& apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev cmake build-essential \
&& cargo build --release --locked \
&& strip /target/release/onionwire \
&& ls -l /target/release/onionwire'
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees \
--exclude=./.ci-tools . \
| docker start -a -i "$BUILD_CONTAINER"
mkdir -p dist
# The recipe writes the stripped binary, its .sha256 and the build-info
# record into /out, and installs its own apt build deps — the caller
# supplies only the source tree and the pinned epoch.
docker cp "$BUILD_CONTAINER:/out/." dist/
docker cp "$BUILD_CONTAINER:/target/release/onionwire" "dist/onionwire-$TARGET"
docker rm -f "$BUILD_CONTAINER" > /dev/null
docker volume rm "$CARGO_TARGET_VOLUME" > /dev/null
- name: Verify the recipe's dist output
- name: Pack and checksum
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}/dist"
ls -l
# scripts/reproducible-build.sh owns the checksum and the build-info
# record. This step only refuses to hand a half-made dist to publish.
for f in "onionwire-$TARGET" "onionwire-$TARGET.sha256" "build-info-$TARGET.txt"; do
if [ ! -s "$f" ]; then
echo "missing or empty dist asset: $f" >&2
bytes=$(wc -c < "onionwire-$TARGET")
if [ "$bytes" -eq 0 ]; then
echo "refusing empty binary onionwire-$TARGET" >&2
exit 1
fi
done
sha256sum -c "onionwire-$TARGET.sha256"
file "onionwire-$TARGET"
cat "build-info-$TARGET.txt"
sha256sum "onionwire-$TARGET" > "onionwire-$TARGET.sha256"
sha256sum -c "onionwire-$TARGET.sha256"
ls -l
- name: Upload dist artifact
uses: https://code.forgejo.org/actions/upload-artifact@v3
@ -446,41 +373,6 @@ jobs:
with:
path: artifacts
- name: Sign the release assets (minisign, fail closed)
if: needs.version.outputs.dry_run != 'true' && needs.aarch64.result == 'success' && needs.x86_64.result == 'success'
env:
MINISIGN_SECRET_KEY: ${{ secrets.MINISIGN_SECRET_KEY }}
RELEASE_TAG: ${{ needs.version.outputs.tag }}
run: |
set -euo pipefail
# Signing runs BEFORE publish on purpose. A run without the key stops
# here, so nothing unsigned ever reaches the release page: an unsigned
# release is indistinguishable from a signed one to anyone who is not
# checking, which makes it worse than no release at all.
if [ -z "${MINISIGN_SECRET_KEY:-}" ]; then
echo "MINISIGN_SECRET_KEY is not set — add it in Settings -> Actions -> Secrets." >&2
echo "See docs/VERIFY.md, \"Maintainer: the signing key\"." >&2
exit 1
fi
# minisign comes from the same pinned image the builds used, so our
# signature and the verifier's check are the same implementation.
docker run --rm \
-v "${GITHUB_WORKSPACE}:/work" \
-e MINISIGN_SECRET_KEY \
-e RELEASE_TAG \
-w /work \
"$RUST_IMAGE" \
bash -c 'apt-get update -qq && apt-get install -y -qq --no-install-recommends minisign >/dev/null \
&& bash .ci-tools/scripts/sign-release.sh \
dist/onionwire-aarch64-unknown-linux-gnu \
dist/onionwire-aarch64-unknown-linux-gnu.sha256 \
dist/onionwire-x86_64-unknown-linux-gnu \
dist/onionwire-x86_64-unknown-linux-gnu.sha256'
# The public key ships as an asset too, so a verifier can get it from
# the release; getting it from the repo instead is stronger, and
# docs/VERIFY.md says so.
cp .ci-tools/scripts/onionwire-signing.pub dist/onionwire-signing.pub
- name: Publish both binaries to one release
if: needs.version.outputs.dry_run != 'true' && needs.aarch64.result == 'success' && needs.x86_64.result == 'success'
env:
@ -492,37 +384,29 @@ jobs:
mkdir -p dist
find artifacts -type f -print
for target in aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do
for name in "onionwire-$target" "onionwire-$target.sha256" "build-info-$target.txt"; do
src=$(find artifacts -type f -name "$name" -print -quit)
if [ -z "$src" ]; then
echo "missing artifact: $name" >&2
src=$(find artifacts -type f -name "onionwire-$target" -print -quit)
sum=$(find artifacts -type f -name "onionwire-$target.sha256" -print -quit)
if [ -z "$src" ] || [ -z "$sum" ]; then
echo "missing artifact for $target" >&2
find artifacts -type f >&2 || true
exit 1
fi
cp "$src" "dist/$name"
done
cp "$src" "dist/onionwire-$target"
cp "$sum" "dist/onionwire-$target.sha256"
done
missing=0
for f in \
dist/onionwire-aarch64-unknown-linux-gnu \
dist/onionwire-aarch64-unknown-linux-gnu.sha256 \
dist/onionwire-aarch64-unknown-linux-gnu.minisig \
dist/onionwire-aarch64-unknown-linux-gnu.sha256.minisig \
dist/build-info-aarch64-unknown-linux-gnu.txt \
dist/onionwire-x86_64-unknown-linux-gnu \
dist/onionwire-x86_64-unknown-linux-gnu.sha256 \
dist/onionwire-x86_64-unknown-linux-gnu.minisig \
dist/onionwire-x86_64-unknown-linux-gnu.sha256.minisig \
dist/build-info-x86_64-unknown-linux-gnu.txt \
dist/onionwire-signing.pub
dist/onionwire-x86_64-unknown-linux-gnu.sha256
do
if [ ! -s "$f" ]; then
echo "refusing to publish missing or empty asset $f" >&2
missing=1
continue
fi
bytes=$(wc -c < "$f")
echo "on disk: $f $bytes bytes"
if [ "$bytes" -eq 0 ]; then
echo "refusing empty asset $f" >&2
missing=1
fi
file "$f" || true
done
if [ "$missing" -ne 0 ]; then
@ -534,15 +418,8 @@ jobs:
.ci-tools/scripts/release-body.md \
dist/onionwire-aarch64-unknown-linux-gnu \
dist/onionwire-aarch64-unknown-linux-gnu.sha256 \
dist/onionwire-aarch64-unknown-linux-gnu.minisig \
dist/onionwire-aarch64-unknown-linux-gnu.sha256.minisig \
dist/build-info-aarch64-unknown-linux-gnu.txt \
dist/onionwire-x86_64-unknown-linux-gnu \
dist/onionwire-x86_64-unknown-linux-gnu.sha256 \
dist/onionwire-x86_64-unknown-linux-gnu.minisig \
dist/onionwire-x86_64-unknown-linux-gnu.sha256.minisig \
dist/build-info-x86_64-unknown-linux-gnu.txt \
dist/onionwire-signing.pub
dist/onionwire-x86_64-unknown-linux-gnu.sha256
- name: Delete tag we created if this job failed
if: failure() && needs.version.outputs.created_tag == 'true' && needs.version.outputs.dry_run != 'true'

View file

@ -12,7 +12,7 @@ rust-version = "1.98"
description = "Lean Tor messenger: Arti in-process, identity=pubkey, onion=locator. No XMPP."
license = "MIT"
publish = false
repository = "https://forgejo.siriusdevops.com/sirius/onionwire"
repository = "https://github.com/sirius0xdev/onionwire"
# TLS backend: `rustls` by default, `native-tls` (OpenSSL) opt-in.
#

View file

@ -19,8 +19,7 @@ Arti and publishes its own v3 onion. There is no C-tor fallback.
[threat model](docs/THREAT_MODEL.md) · [audit notes](docs/SECURITY_AUDIT.md)
(in-house, **not** a third-party audit). Index: [docs/README.md](docs/README.md).
TUI keys: [docs/TUI.md](docs/TUI.md). Wallet: [docs/WALLET.md](docs/WALLET.md).
Releases: [docs/RELEASING.md](docs/RELEASING.md). Verifying a download:
[docs/VERIFY.md](docs/VERIFY.md).
Releases: [docs/RELEASING.md](docs/RELEASING.md).
## Install
@ -47,13 +46,6 @@ The Android APK + AAR attach to **the same tag** by a second dispatch of
`android-release` with `tag=<that tag>`. Policy: [docs/RELEASING.md](docs/RELEASING.md).
This Forgejo does not serve `/releases/latest/download/…` (404); pin the tag.
Every asset is signed with minisign, and every binary is reproducible from its
tag: pin the builder image by digest, fix the build paths and `SOURCE_DATE_EPOCH`,
and the published hash can be rebuilt and compared by anyone. Before running a
download, read [docs/VERIFY.md](docs/VERIFY.md). Each release carries
`build-info-<target>.txt` (commit, epoch, toolchain, builder image digest,
resulting hash) next to its `.sha256`.
**x86_64:**
```bash

View file

@ -16,11 +16,7 @@ Operator / product docs:
- **[TUI.md](TUI.md)** — screens and keybindings as the TUI actually handles them.
- **[WALLET.md](WALLET.md)** — loopback wallet RPC, chain source, spend-authority
warning, receipt verification.
- **[RELEASING.md](RELEASING.md)** — manual, batched releases (not one per merge),
the reproducible build recipe, and the signing key.
- **[VERIFY.md](VERIFY.md)** — checking a download: the dependency graph, the
wallet's real exposure, rebuilding a release and comparing bytes, and what
none of that proves.
- **[RELEASING.md](RELEASING.md)** — manual, batched releases (not one per merge).
- **[ARTI_UPGRADE.md](ARTI_UPGRADE.md)** — how to bump the in-process Tor crates.
Android build notes: [android/README.md](../android/README.md). SDK:

View file

@ -45,31 +45,9 @@ 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. 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.
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.
## Inputs
@ -97,18 +75,9 @@ 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 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.
`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.
`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
@ -199,57 +168,6 @@ 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

View file

@ -1,249 +0,0 @@
# Verifying OnionWire
You were told OnionWire is a honeypot, or a trojan that steals Monero. That is a
claim about a *binary*, and it deserves an answer you can check yourself in ten
minutes rather than an argument you have to take on faith.
This document is that answer. It is written so that nothing here has to be
believed: every section is a command whose output you read yourself.
If you only do one thing, do [Check 3](#check-3--10-minutes-rebuild-the-release-and-compare-bytes).
It is the one that actually settles the question, and it is the thing most
projects claiming "the source is public" cannot offer.
---
## What OnionWire can do to your Monero, and what it cannot
Start with the honest part, because a threat model that only lists the good news
is not a threat model.
**The wallet is optional and chat never needs it.** OnionWire is a messenger.
With no wallet configured at all there is no seed, no spend key, and no code
path that touches Monero. `docs/WALLET.md` opens with that sentence and it is
literally true.
**By default it cannot spend.** No seed and no spend key are on the device.
Receive works from a profile address or a view-only wallet. `/tip` is refused
locally, before any network dial, unless spend was explicitly turned on at
wallet create/restore. `ONIONWIRE_WALLET_NO_SPEND=1` forces that refusal.
**A view-only wallet is detected and cannot be spent.** OnionWire probes
`query_key` with `key_type=spend_key`; monero answers `-29 WATCH_ONLY`
("Cannot retrieve spend key") for a wallet with no spend key, and that answer is
what the app keys off. It cannot extract a spend key that is not in the wallet.
**The wallet RPC is loopback-only, and it demands a login.** OnionWire refuses
an RPC URL with no credentials and refuses to run against an open RPC. It never
puts wallet RPC on clearnet and never over `.onion`, and it never passes
`--trusted-daemon`.
**The part that is genuinely exposure — read this one.** In *app-owned wallet*
mode OnionWire spawns `monero-wallet-rpc` itself and therefore knows the RPC
credentials it set. It can read the open wallet's recovery phrase, and it does:
`src/wallet.rs` calls `query_key keytype=mnemonic` to drive the backup screen,
and `query_key spend_key` / `view_key` for the key-display actions. `docs/THREAT_MODEL.md`
says so directly — "the recovery phrase and the private keys are displayable on
demand", and a spend-capable wallet makes OnionWire "a local spend authority for
that file".
So: **a malicious build of that path could exfiltrate a seed.** That is not
spin, it is the surface. The mitigations are that the seed-read is a user-
initiated action on a wallet you chose to give it, that a funded wallet should
be a separate hot wallet rather than savings, and that if you want OnionWire to
*not* be able to spend, point it at a view-only wallet or run it with no wallet
at all. The threat model already recommends exactly this; it is not a
concession extracted by criticism.
The rest of this document is about how you check that the binary you downloaded
is the code described above, and not something else.
---
## Check 1 — 30 seconds: what code is even in the binary
From a clone, on whatever commit you are interested in:
```bash
cargo tree --locked -e normal --depth 1 # direct dependencies: 27 of them
cargo tree --locked -e normal | wc -l # ~523 crates in total
```
The direct list is the one worth reading. All 27 are known crates:
```
argon2 arti-client chacha20poly1305 cuprated ed25519-dalek futures hkdf
hmac md-5 qrcode rand ratatui rpassword rusqlite rustls safelog
serde_json sha2 sha3 snow tokio toml tor-cell tor-hsservice
tor-rtcompat x25519-dalek zeroize
```
Two of those deserve naming, because they are the honest answer to "why is there
HTTP in a chat program":
- **`arti-client`** — Tor, in-process.
- **`cuprated`** — the in-process Monero chain node, pinned to a git revision.
It is a **default feature**, so the release binary ships it.
That second one is why the graph contains `hyper`, `axum`, `tower-http` and
`http`. Do not take a grep's word for provenance — ask the graph:
```bash
cargo tree --locked -e normal -i http # axum <- cuprate-rpc-interface <- cuprated
cargo tree --locked -e normal -i reqwest # "did not match any packages"
```
`axum` and `hyper` are Cuprate's **JSON-RPC server** — the thing that answers a
wallet client on loopback. That is a server, not a client. `http`/`httparse`
also reach the graph through Arti's directory client, which speaks the Tor
directory protocol inside a Tor circuit.
What is genuinely absent, and worth confirming yourself:
- **No HTTP client.** `cargo tree -i reqwest` matches nothing: no `reqwest`,
`ureq`, `isahc` or `curl` anywhere.
- **No telemetry.** No Sentry, analytics or crash-reporting SDK in the graph.
## Check 2 — 2 minutes: run it with no wallet at all
```bash
ONIONWIRE_WALLET_NO_SPEND=1 ./onionwire
```
Chat, invites, onion rotation and the ratchet all work. Nothing about Monero is
reachable. If your concern is specifically "steals Monero", this is the
configuration where the concern does not apply.
**The clearnet traffic you will see, stated plainly.** The release binary's
default feature set includes the in-process Cuprate node. If you start a chain
source, that node syncs to the Monero P2P network over clearnet, and you will
see it in `sudo ss -tupn` or `tcpdump`. That is the node doing its job — it is
not the messenger phoning home and it carries no chat data — but it *is* real
outbound traffic, and any "no clearnet at all" claim would be false without
this sentence.
If you do not want it:
- leave the chain source unset and unstarted (`F7`), and let a wallet RPC you
run yourself be the only Monero side; or
- build without it: `cargo build --release --no-default-features --features rustls`.
Honest note on that second option: a `--no-default-features` binary is a
different build and will not match the published hash. Building it yourself is
the trust-minimising move — you just cannot use Check 3 to compare it against a
download.
## Check 3 — 10 minutes: rebuild the release and compare bytes
This is the real check. It answers the only objection that survives "the source
is public": *the binary I downloaded might not be that source.*
```bash
git clone https://forgejo.siriusdevops.com/sirius/onionwire
cd onionwire
git fetch --tags
scripts/verify-reproducible.sh v0.14.0
```
Replace `v0.14.0` with the tag you are checking. You need docker; you do not
need Rust, or the right glibc, or the right distro. The rebuild happens inside
the same builder image, pinned **by digest**, that CI uses, with the source
paths, the target path, and `SOURCE_DATE_EPOCH` all fixed by
`scripts/reproducible-build.sh`.
It prints one of:
```
RESULT: MATCH — the published onionwire-x86_64-unknown-linux-gnu is
byte-for-byte the output of commit <sha> built with the documented recipe.
```
or `RESULT: MISMATCH` and exits non-zero.
**What a MATCH proves:** the released binary is exactly what this source
compiles to with this recipe. Auditing the source is therefore sufficient —
which is the property that was missing before, and the one the "just read the
code" argument always quietly assumed.
**What a MATCH does not prove:** that the source is benign. A project could
publish source that does something bad and a binary that faithfully implements
it. Reproducibility removes the *builder* from your trust set; it does not
remove the *author*. Judging the source is still yours to do — now at least
against a binary you know corresponds to it.
A mismatch is a finding, not a glitch. The release also carries
`build-info-<triple>.txt` recording the commit, epoch, toolchain, builder image
digest and resulting hash, so you can see whether the release was cut from a
different commit or the pinned image moved before you cry foul.
## Check 4 — verify the release signature
Every binary and checksum asset is signed with [minisign](https://jedisct1.github.io/minisign/).
The public key lives in the repo at `scripts/onionwire-signing.pub` and is also
published as a release asset — get it from the repo, not from the same download
you are checking, or the signature proves nothing.
```bash
minisign -Vm onionwire-x86_64-unknown-linux-gnu -p onionwire-signing.pub
```
`Signature and comment signature verified` means the file is the one signed by
that key. A `.sha256` file next to a binary only proves the download matches the
release page; a signature proves the artifact is the one the maintainer signed,
even if the release page is later altered.
---
## What is still not proven
So that nobody over-claims on our behalf:
- **There is no third-party audit.** `docs/SECURITY_AUDIT.md` is explicitly
in-house. It is a starting point for a reviewer, not a substitute for one.
- **Reproducible builds pin the build, not the intent.** See above.
- **The seed-display capability is by design.** If you consider "an app that can
read my seed" unacceptable regardless of what it does with it, then do not
give OnionWire a spend-capable wallet. Use a view-only wallet or none. That is
a legitimate position and OnionWire supports it without argument.
- **A build you compile yourself is stronger than a verified download.** If you
want the shortest trust chain, `git clone && cargo build --release` beats both
the signature and the reproduction check, because there is no released binary
to trust at all.
If you find a discrepancy, a way to exfiltrate a seed, or a signature that does
not verify, that is exactly what these checks are for. Report it.
---
## Maintainer: the signing key
One-time setup, on a machine you control:
```bash
minisign -G -W -p scripts/onionwire-signing.pub -s onionwire-signing.key
```
`-W` means the secret key is not encrypted: CI cannot answer a password prompt,
and a passphrase stored beside the key in the same secret store protects nothing.
Then:
1. Commit `scripts/onionwire-signing.pub`.
2. Store the **contents** of `onionwire-signing.key` as the Forgejo Actions
secret `MINISIGN_SECRET_KEY` (Settings → Actions → Secrets).
3. Delete `onionwire-signing.key` from your machine, or keep it somewhere
genuinely offline. Anyone holding it can sign a release.
`scripts/sign-release.sh` fails closed: with no key, or if a signature it just
produced does not verify against the committed public key, it exits non-zero and
the release is not published. That is deliberate — an unsigned release is worse
than a missing one, because it looks the same as a signed one to anyone who is
not checking.
## Maintainer: the builder image digest
`BUILDER_IMAGE` is pinned by digest in three files that must agree:
`.forgejo/workflows/release.yml` (`RUST_IMAGE`), `scripts/verify-reproducible.sh`,
and `scripts/build-release-local.sh`. When you bump it, the released hashes are
expected to change — that is a toolchain change, not a compromise. Bump all three
in one commit so a verifier never rebuilds with a different toolchain than CI
shipped.

View file

@ -1,14 +1,10 @@
#!/usr/bin/env bash
# Offline fallback: build and publish the x86_64 release asset from this host
# when CI (.forgejo/workflows/release.yml) cannot be used.
# Offline fallback: build the x86_64 release asset on this host and publish it
# to the Forgejo release for <tag>. CI (.forgejo/workflows/release.yml) now
# builds both aarch64 (Pi runner) and x86_64 (amd64 runner). Use this script
# when you cannot wait for CI or the amd64 runner is down.
#
# Usage: MINISIGN_SECRET_KEY=... FORGEJO_TOKEN=... scripts/build-release-local.sh v0.14.0
#
# It runs the SAME recipe CI runs, inside the same digest-pinned builder image,
# so the asset it publishes is one a verifier can reproduce. A plain host
# `cargo build` would not be: different rustc, different build paths, different
# bytes — and the published hash would then match nothing anyone could rebuild,
# which is worse than having no fallback at all.
# Usage: FORGEJO_TOKEN=... scripts/build-release-local.sh v0.1.0
#
# Does not create or push the tag: the release workflow owns tagging. Idempotent
# (same-named assets are replaced). Never moves an existing tag.
@ -19,62 +15,22 @@ target=x86_64-unknown-linux-gnu
root="$(cd "$(dirname "$0")/.." && pwd)"
cd "$root"
# Must equal RUST_IMAGE in .forgejo/workflows/release.yml and BUILDER_IMAGE in
# scripts/verify-reproducible.sh. Three copies, one digest — see docs/VERIFY.md.
BUILDER_IMAGE="rust@sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e"
command -v docker >/dev/null 2>&1 || {
echo "build-release-local: docker is required (the build runs in the pinned image)" >&2
exit 1
}
expected="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
if [ "$tag" != "v$expected" ]; then
echo "warn: tag $tag does not match Cargo.toml version $expected (--version will report $expected)"
fi
sha="$(git rev-parse --verify "$tag^{commit}" 2>/dev/null)" || {
echo "build-release-local: tag $tag not found — run: git fetch --tags" >&2
exit 1
}
sde="$(git log -1 --format=%ct "$sha")"
echo "==> $tag at $sha, SOURCE_DATE_EPOCH=$sde"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
mkdir -p "$work/src" "$work/out" "$work/target"
git archive "$sha" | tar -x -C "$work/src"
docker volume create onionwire-local-registry >/dev/null
docker run --rm \
-v "$work/src:/src:ro" \
-v onionwire-local-registry:/usr/local/cargo/registry \
-v "$work/target:/target" \
-v "$work/out:/out" \
-e SOURCE_DATE_EPOCH="$sde" \
-e BUILDER_IMAGE="$BUILDER_IMAGE" \
-e TARGET_TRIPLE="$target" \
-e GIT_SHA="$sha" \
-w /src \
"$BUILDER_IMAGE" \
bash scripts/reproducible-build.sh
echo "==> cargo build --release --locked"
cargo build --release --locked
mkdir -p dist
cp "$work/out/onionwire-$target" \
"$work/out/onionwire-$target.sha256" \
"$work/out/build-info-$target.txt" \
dist/
file "dist/onionwire-$target"
"dist/onionwire-$target" --version
echo "==> signing (needs minisign on PATH and the committed public key)"
RELEASE_TAG="$tag" scripts/sign-release.sh \
"dist/onionwire-$target" "dist/onionwire-$target.sha256"
asset="onionwire-$target"
cp "target/release/onionwire" "dist/$asset"
strip "dist/$asset"
(cd dist && sha256sum "$asset" > "$asset.sha256" && sha256sum -c "$asset.sha256")
file "dist/$asset"
"dist/$asset" --version
echo "==> publishing to the release for $tag"
scripts/publish-release.sh "$tag" "OnionWire $tag" scripts/release-body.md \
"dist/onionwire-$target" \
"dist/onionwire-$target.sha256" \
"dist/onionwire-$target.minisig" \
"dist/onionwire-$target.sha256.minisig" \
"dist/build-info-$target.txt"
"dist/$asset" "dist/$asset.sha256"

View file

@ -6,14 +6,12 @@ Prebuilt Linux binaries. No `tor` package required — Arti runs in-process.
# aarch64 (Raspberry Pi, ARM servers)
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-aarch64-unknown-linux-gnu
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-aarch64-unknown-linux-gnu.sha256
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-aarch64-unknown-linux-gnu.minisig
sha256sum -c onionwire-aarch64-unknown-linux-gnu.sha256
chmod +x onionwire-aarch64-unknown-linux-gnu
# x86_64 (most PCs / VMs)
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-x86_64-unknown-linux-gnu
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-x86_64-unknown-linux-gnu.sha256
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/releases/download/@TAG@/onionwire-x86_64-unknown-linux-gnu.minisig
sha256sum -c onionwire-x86_64-unknown-linux-gnu.sha256
chmod +x onionwire-x86_64-unknown-linux-gnu
@ -24,29 +22,4 @@ Keep the asset filenames so `sha256sum -c` matches. The TLS stack is rustls and
OpenSSL (for SQLCipher) is compiled in from vendored sources, so the binaries
have no dynamic `libssl` dependency.
## Verify before you run it
A `.sha256` only proves your download matches this page. Both assets are also
signed with minisign, and every binary is reproducible from the tag.
```bash
# 1. The signature. Take the key from the repo, not from this page:
# a signature checked against a key fetched from the same place it is
# supposed to vouch for proves nothing.
curl -fL -O https://forgejo.siriusdevops.com/sirius/onionwire/raw/branch/main/scripts/onionwire-signing.pub
minisign -Vm onionwire-x86_64-unknown-linux-gnu -p onionwire-signing.pub
# 2. The bytes: rebuild this tag and compare, byte for byte.
git clone https://forgejo.siriusdevops.com/sirius/onionwire
cd onionwire && git fetch --tags
scripts/verify-reproducible.sh @TAG@
```
`build-info-<target>.txt`, attached to this release, records the commit, the
source date epoch, the toolchain and the builder image digest behind each hash —
so a mismatch can be diagnosed instead of merely reported.
Full walkthrough, including what these checks do and do not prove:
[`docs/VERIFY.md`](https://forgejo.siriusdevops.com/sirius/onionwire/src/branch/main/docs/VERIFY.md).
Building from source is covered in the README install guide.

View file

@ -1,144 +0,0 @@
#!/usr/bin/env bash
# Canonical OnionWire release build. RUNS INSIDE THE PINNED BUILDER IMAGE
# (BUILDER_IMAGE in .forgejo/workflows/release.yml — pinned by digest, not by a
# floating tag, and recorded in the build-info asset).
#
# This is the only supported way to produce a release binary. The bytes it
# emits are exactly what `scripts/verify-reproducible.sh` rebuilds and compares,
# so anything that can move those bytes is pinned here rather than left to the
# environment:
#
# * the builder image, by digest — `rust:1.98-bookworm` floats, and rustc
# patches change codegen;
# * every absolute build path (source, cargo target dir, cargo registry).
# rustc's `--remap-path-prefix` covers paths that reach rustc's own
# strings and debug info, but NOT absolute paths compiled in by a C
# toolchain — and this crate always has one: rusqlite's
# `bundled-sqlcipher-vendored-openssl` feature compiles OpenSSL from
# source, and OpenSSL bakes its build and config paths into the artifact.
# The build therefore happens at fixed paths inside the container;
# * SOURCE_DATE_EPOCH, from the released commit's committer date, so no
# build clock reaches the output (OpenSSL and any date-dependent crate
# read it);
# * the dependency graph, via `--locked`;
# * the strip step and its exact flag (binutils versions differ between
# hosts; inside the pinned image they do not).
#
# RUSTFLAGS is *replaced*, never extended. An ambient RUSTFLAGS from a shell
# profile or a CI default would silently change the output bytes, which is
# precisely the thing this script exists to prevent.
#
# Inputs (env):
# SOURCE_DATE_EPOCH required. `git log -1 --format=%ct <released-commit>`
# SRC source checkout (default /src)
# CARGO_TARGET_DIR build directory (default /target)
# OUT where dist assets are written (default /out)
# TARGET_TRIPLE asset name triple, defaults to the image's rustc host
# BUILDER_IMAGE recorded in build-info.txt only (no effect on bytes)
# CARGO_BUILD_JOBS build parallelism (no effect on bytes; default 2)
#
# Outputs in $OUT:
# onionwire-<triple> the stripped binary
# onionwire-<triple>.sha256 sha256sum-format checksum of it
# build-info-<triple>.txt the recipe record: toolchain, epoch, commit,
# image, and the hash this run produced
set -euo pipefail
SRC="${SRC:-/src}"
OUT="${OUT:-/out}"
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-/target}"
: "${SOURCE_DATE_EPOCH:?set SOURCE_DATE_EPOCH to the committer time of the released commit: git log -1 --format=%ct <sha>}"
export SOURCE_DATE_EPOCH
# No colour, no progress bars: not a determinism input, but it keeps CI logs
# diffable between two builds of the same commit.
export CARGO_TERM_COLOR=never
export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-2}"
# Fixed paths. The remaps make the output independent of where $SRC actually
# lives on the verifying host; the container keeps the paths themselves fixed
# for the C toolchains that ignore remapping entirely.
#
# CARGO_HOME is remapped as a whole, not just `registry`: the default feature
# set pulls `cuprated` from a pinned git revision, and its checkout lands under
# `$CARGO_HOME/git/...` — a path that would otherwise reach the artifact through
# cuprate's own `file!()`/panic locations.
CARGO_HOME_DIR="${CARGO_HOME:-/usr/local/cargo}"
export RUSTFLAGS="--remap-path-prefix=${SRC}=/onionwire --remap-path-prefix=${CARGO_TARGET_DIR}=/onionwire/target --remap-path-prefix=${CARGO_HOME_DIR}=/cargo"
cd "$SRC"
# Build dependencies are installed HERE rather than by the caller, so CI and a
# verifier get the same toolchain. `cmake` and a C toolchain are required because
# the default feature set includes `cuprate-daemon` (RandomX + fjall), which the
# release binary ships.
#
# Honest limit: these apt packages are not digest-pinned the way the image is, so
# a Debian security update to gcc or cmake can move the output bytes. build-info
# records their versions, so that mismatch is diagnosable instead of mysterious.
apt-get -o Acquire::Retries=5 -o Acquire::ForceIPv4=true update
apt-get -o Acquire::Retries=5 -o Acquire::ForceIPv4=true install -y --no-install-recommends \
pkg-config libssl-dev cmake build-essential
TARGET_TRIPLE="${TARGET_TRIPLE:-$(rustc -vV | sed -n 's/^host: //p')}"
[ -n "$TARGET_TRIPLE" ] || { echo "could not determine the target triple from rustc -vV" >&2; exit 1; }
# Derived once into variables: the values are wanted twice (the log line and
# build-info.txt), and nesting a command substitution with its own quotes
# inside a double-quoted string is where this file previously broke.
EPOCH_UTC="$(date -u -d "@${SOURCE_DATE_EPOCH}" +%Y-%m-%dT%H:%M:%SZ)"
RUSTC_VV="$(rustc -Vv | tr '\n' ' ' | sed 's/ */ /g')"
CARGO_V="$(cargo -V)"
STRIP_V="$(strip --version | head -1)"
CC_V="$(cc --version | head -1)"
CMAKE_V="$(cmake --version | head -1)"
echo "==> builder image: ${BUILDER_IMAGE:-unknown}"
echo "==> rustc: ${RUSTC_VV}"
echo "==> cargo: ${CARGO_V}"
echo "==> SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH} (${EPOCH_UTC})"
echo "==> RUSTFLAGS: ${RUSTFLAGS}"
cargo build --release --locked --bin onionwire
BIN="${CARGO_TARGET_DIR}/release/onionwire"
[ -f "$BIN" ] || { echo "no binary at $BIN" >&2; exit 1; }
# CI passes the released sha in (the builder image has no git checkout to read);
# a verifier running this from a clone lets it derive the sha itself.
GIT_SHA="${GIT_SHA:-$(git -C "$SRC" rev-parse HEAD 2>/dev/null || echo unknown)}"
strip --strip-all "$BIN"
mkdir -p "$OUT"
install -m 755 "$BIN" "${OUT}/onionwire-${TARGET_TRIPLE}"
(
cd "$OUT"
sha256sum "onionwire-${TARGET_TRIPLE}" > "onionwire-${TARGET_TRIPLE}.sha256"
sha256sum -c "onionwire-${TARGET_TRIPLE}.sha256"
)
# The recipe record. Published next to the binary so a verifier can see which
# toolchain, epoch and commit produced the hash they are comparing against
# without having to reverse it out of a CI log.
BINARY_SHA="$(cut -d' ' -f1 < "${OUT}/onionwire-${TARGET_TRIPLE}.sha256")"
{
echo "onionwire ${TARGET_TRIPLE}"
echo "commit: ${GIT_SHA}"
echo "source_date_epoch: ${SOURCE_DATE_EPOCH}"
echo "commit_time_utc: ${EPOCH_UTC}"
echo "builder_image: ${BUILDER_IMAGE:-unknown}"
echo "rustc: ${RUSTC_VV}"
echo "cargo: ${CARGO_V}"
echo "strip: ${STRIP_V}"
echo "cc: ${CC_V}"
echo "cmake: ${CMAKE_V}"
echo "rustflags: ${RUSTFLAGS}"
echo "build_command: cargo build --release --locked --bin onionwire"
echo "sha256: ${BINARY_SHA}"
} > "${OUT}/build-info-${TARGET_TRIPLE}.txt"
echo "==> build-info-${TARGET_TRIPLE}.txt"
cat "${OUT}/build-info-${TARGET_TRIPLE}.txt"

View file

@ -1,81 +0,0 @@
#!/usr/bin/env bash
# Sign release assets with minisign, and verify our own signatures before
# anything reaches the release page.
#
# Usage: sign-release.sh <file> [<file>...]
#
# Env:
# MINISIGN_SECRET_KEY contents of the secret key file (required).
# A CI secret; never committed, never passed as an arg.
# MINISIGN_PUBKEY_FILE default scripts/onionwire-signing.pub
# RELEASE_TAG optional; recorded in the trusted comment
#
# Fail closed by design. If the key is missing or a signature we just made does
# not verify, this exits non-zero and the publish job stops — an unsigned
# release is worse than a missing one, because it looks identical to a signed
# one to anyone who is not checking.
#
# The key must be generated WITHOUT a password (`minisign -G -W`): CI cannot
# answer a prompt, and a passphrase that has to sit next to the key in the same
# secret store protects nothing. The secret lives only in Forgejo Actions
# secrets; the public half is committed so verifiers have it out-of-band from
# the release page. See docs/VERIFY.md.
set -euo pipefail
[ "$#" -ge 1 ] || { echo "usage: sign-release.sh <file> [<file>...]" >&2; exit 1; }
root="$(cd "$(dirname "$0")/.." && pwd)"
pub_file="${MINISIGN_PUBKEY_FILE:-$root/scripts/onionwire-signing.pub}"
command -v minisign >/dev/null 2>&1 || {
echo "sign-release: minisign is not installed (apt-get install -y minisign)" >&2
exit 1
}
[ -s "$pub_file" ] || {
echo "sign-release: no public key at $pub_file" >&2
echo " Generate the pair once, on a machine you control:" >&2
echo " minisign -G -W -p scripts/onionwire-signing.pub -s onionwire-signing.key" >&2
echo " Commit the .pub file, store the .key file's contents as the Forgejo" >&2
echo " Actions secret MINISIGN_SECRET_KEY, then delete the .key file." >&2
echo " Procedure: docs/VERIFY.md, \"Maintainer: the signing key\"." >&2
exit 1
}
: "${MINISIGN_SECRET_KEY:?MINISIGN_SECRET_KEY is not set — add it as a Forgejo Actions secret; see docs/VERIFY.md}"
tmp="$(mktemp -d)"
cleanup() {
# The secret key is on disk for the length of this script and no longer.
if [ -f "$tmp/onionwire-signing.key" ]; then
shred -uz "$tmp/onionwire-signing.key" 2>/dev/null || rm -f "$tmp/onionwire-signing.key"
fi
rm -rf "$tmp"
}
trap cleanup EXIT
umask 077
printf '%s\n' "$MINISIGN_SECRET_KEY" > "$tmp/onionwire-signing.key"
chmod 600 "$tmp/onionwire-signing.key"
# Warm the signature with the same secret we just wrote: an unreadable or
# truncated secret fails here rather than after three files are half-signed.
[ -s "$tmp/onionwire-signing.key" ] || { echo "sign-release: the secret key is empty" >&2; exit 1; }
comment="OnionWire ${RELEASE_TAG:-release}"
for f in "$@"; do
[ -f "$f" ] || { echo "sign-release: no such file: $f" >&2; exit 1; }
bytes=$(wc -c < "$f")
[ "$bytes" -gt 0 ] || { echo "sign-release: refusing to sign empty file $f" >&2; exit 1; }
minisign -S -W -s "$tmp/onionwire-signing.key" -m "$f" -x "$f.minisig" \
-t "$comment" -c "signature for $(basename "$f")"
[ -s "$f.minisig" ] || { echo "sign-release: minisign produced no signature for $f" >&2; exit 1; }
# Verify with the public half, not with the secret we just used: this is the
# check a user will run, so it is the check we run.
minisign -V -p "$pub_file" -m "$f" -x "$f.minisig" -q \
|| { echo "sign-release: our own signature for $f does not verify against $pub_file" >&2; exit 1; }
echo "sign-release: signed and verified $(basename "$f") -> $(basename "$f").minisig"
done

View file

@ -1,124 +0,0 @@
#!/usr/bin/env bash
# Rebuild a released OnionWire binary from source and compare it, byte for
# byte, with the asset on the release page.
#
# Usage:
# scripts/verify-reproducible.sh <tag> [published .sha256 file or URL]
#
# ./scripts/verify-reproducible.sh v0.14.0
# ./scripts/verify-reproducible.sh v0.14.0 /path/to/onionwire-x86_64-unknown-linux-gnu.sha256
#
# Why this exists: "the source is public" is not a check anyone can run. This
# is. It rebuilds the tag's exact tree inside the same pinned builder image CI
# uses and tells you whether the bytes match. A mismatch is a finding — it means
# the published binary did not come from this source with this recipe.
#
# What it needs: docker, git, and the tag in your local clone (`git fetch --tags`).
# It never touches your working tree: the tag tree is exported with
# `git archive`, and everything is built in a temp dir that is removed on exit.
#
# What it does NOT depend on: your rustc, your distro, your glibc, your
# CPU count. All of that is inside the pinned image.
set -euo pipefail
BUILDER_IMAGE="rust@sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e"
RELEASE_BASE="${ONIONWIRE_RELEASE_BASE:-https://forgejo.siriusdevops.com/sirius/onionwire/releases/download}"
die() { echo "verify: $*" >&2; exit 1; }
tag="${1:?usage: verify-reproducible.sh <tag> [published .sha256 file or URL]}"
expect_src="${2:-}"
command -v docker >/dev/null 2>&1 || die "docker is required to rebuild in the pinned builder image"
command -v git >/dev/null 2>&1 || die "git is required"
repo="$(cd "$(dirname "$0")/.." && pwd)"
sha="$(git -C "$repo" rev-parse --verify "$tag^{commit}" 2>/dev/null)" \
|| die "tag $tag not found locally — run: git fetch --tags"
sde="$(git -C "$repo" log -1 --format=%ct "$sha")"
echo "verify: tag $tag"
echo "verify: commit $sha"
echo "verify: source_date_epoch $sde"
echo "verify: builder image $BUILDER_IMAGE"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
# Export the tag, not the working tree: a dirty checkout would otherwise build
# something that was never released.
mkdir -p "$work/src" "$work/out" "$work/target"
git -C "$repo" archive "$sha" | tar -x -C "$work/src"
[ -f "$work/src/scripts/reproducible-build.sh" ] \
|| die "$tag has no scripts/reproducible-build.sh — it predates reproducible releases"
echo "verify: building (this is a full release build; expect several minutes)"
docker volume create onionwire-verify-registry >/dev/null
docker run --rm \
-v "$work/src:/src:ro" \
-v onionwire-verify-registry:/usr/local/cargo/registry \
-v "$work/target:/target" \
-v "$work/out:/out" \
-e SOURCE_DATE_EPOCH="$sde" \
-e BUILDER_IMAGE="$BUILDER_IMAGE" \
-e CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-}" \
-w /src \
"$BUILDER_IMAGE" \
bash scripts/reproducible-build.sh
sha_file="$(ls "$work"/out/*.sha256 2>/dev/null | head -1)" || true
[ -n "${sha_file:-}" ] || die "the build produced no .sha256 — see the build output above"
asset="$(basename "$sha_file" .sha256)"
mine="$(cut -d' ' -f1 < "$sha_file")"
echo "verify: rebuilt $asset"
echo "verify: rebuilt sha256 $mine"
# The published hash: an explicit path/URL if given, else the release asset.
tmp_expect="$work/expect.sha256"
if [ -n "$expect_src" ]; then
if [ -f "$expect_src" ]; then
cp "$expect_src" "$tmp_expect"
else
echo "verify: fetching $expect_src"
curl -fsSL "$expect_src" -o "$tmp_expect" \
|| die "could not fetch the published checksum from $expect_src"
fi
else
url="$RELEASE_BASE/$tag/$asset.sha256"
echo "verify: fetching $url"
curl -fsSL "$url" -o "$tmp_expect" \
|| die "could not download $url — pass the published .sha256 as the second argument instead"
fi
theirs="$(cut -d' ' -f1 < "$tmp_expect")"
echo "verify: published sha256 $theirs"
echo
if [ "$mine" = "$theirs" ]; then
echo "RESULT: MATCH — the published $asset is byte-for-byte the output of"
echo " commit $sha built with the documented recipe."
echo
echo "The rebuilt binary is at:"
echo " $work/out/$asset"
echo "(it is deleted when this script exits; copy it out first if you want it)"
# Keep the artifact for the user: the trap would remove it, so copy next to
# the caller unless they asked for a scratch run.
if [ -n "${ONIONWIRE_VERIFY_KEEP:-}" ]; then
mkdir -p "$ONIONWIRE_VERIFY_KEEP"
cp "$work/out/$asset" "$ONIONWIRE_VERIFY_KEEP/"
echo "copied to $ONIONWIRE_VERIFY_KEEP/$asset (ONIONWIRE_VERIFY_KEEP)"
fi
else
echo "RESULT: MISMATCH — the published binary does NOT match a rebuild of this tag." >&2
echo " rebuilt: $mine" >&2
echo " published: $theirs" >&2
echo >&2
echo "This is a real finding, not a glitch to shrug at. Report it, and do not" >&2
echo "run the published binary until it is explained. Two honest causes to rule" >&2
echo "out first: the release was built from a different commit than the tag, or" >&2
echo "the builder image digest moved (compare build-info-*.txt on the release)." >&2
exit 1
fi