release: reproducible builds, and sign every asset
All checks were successful
android-ci / android (pull_request) Successful in 12m34s
ci / test (pull_request) Successful in 13m28s
ci / sdk (pull_request) Successful in 1m13s

"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:
agent 2026-10-11 12:20:08 -04:00
commit 601f640f78
No known key found for this signature in database
11 changed files with 962 additions and 76 deletions

View file

@ -16,7 +16,11 @@ 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).
- **[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.
- **[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,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

249
docs/VERIFY.md Normal file
View file

@ -0,0 +1,249 @@
# 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.