wharfy 0.22.0 — 配ったものが、どこから出たかを証明します

配ったものが、どのリポジトリのどの workflow から出たかを、利用者が確かめられます。

配ったものすべてに来歴が付きます

GitHub Actions で release / publish を走らせると、利用者に届くものひとつひとつの sha256 に 来歴(build provenance)が付きます。ビルドの成果物だけではありません。curl | sh で実行される install.sh も、更新チェックの向き先になる latest.json も入ります。

何に付くか 利用者の確かめ方
アーカイブ・パッケージ・バンドル gh attestation verify <file> --repo acme/demo
install.sh / install.ps1 / latest.json 同じコマンド(来歴は配ったバイト列に付きます)
コンテナイメージ gh attestation verify oci://ghcr.io/acme/demo:1.2.0 --repo acme/demo

どこから取っても、同じ来歴で確かめられます

来歴は digest で引きます。どのホストが配ったかは関係ありません。tap・scoop の bucket・AUR・ apt / rpm リポジトリが同じファイルを配っているなら、そこから取った利用者も同じコマンドで検算できます。

イメージの来歴は publish で付きます

イメージを名指せるのは manifest digest だけで、その digest は push を受けたレジストリが返して 初めて決まります。だから来歴が付くのは release ではなく publish です。

鍵は要らず、permissions だけで済みます

作るものも、置き場所も、更新するものもありません。workflow に要るのはこれだけです。

permissions:
  contents: write
  packages: write
  id-token: write        # 来歴に署名する(Actions が workflow に渡す身元)
  attestations: write    # 来歴はリポジトリに保管される

手元では来歴は付きません。status がそう言います。

$ wharfy status
demo
attest: no OIDC token available — provenance is signed with the identity GitHub Actions hands the workflow, so nothing is attested from a laptop (in CI: permissions: id-token: write)

verify が、利用者と同じやり方で来歴を引き直します

来歴は、付けただけでは効いているとは言えません。署名の形が違う、透明性ログに載っていない、一部の 成果物にしか付いていない——どれも配る側からは付いているように見えます。verify は利用者と同じ やり方で引き直し、引けなければ失敗にします。

$ wharfy verify --version 1.2.0
✓ verified releases, script, attest
  attest: all 13 shipped artifacts on v1.2.0 carry verifiable provenance from this repository's workflow (signed, logged in rekor, and bound to the bytes users receive)
$ wharfy verify --version 1.2.0
✗ failed attest
  ! attest_unverified: attest: none of the 13 shipped artifacts on v1.2.0 carry build provenance — nothing proves they came from this repository's workflow; release attaches it when it runs in github actions with permissions: id-token: write / attestations: write

資産の中身を、落とさずに照合します

既定の verify は「その名前の資産が在る」ことしか見ておらず、中身を見るのは --install を付けた ときだけでした。アップロードが途中で切れた、後から差し替えられた、は名前が在るぶん見逃していました。 GitHub は資産ごとに digest を返すので、落とさずとも checksums の宣言と突き合わせられます。 毎回の verify で見つかります。

変更前

$ wharfy verify --version 1.2.0
✓ verified releases
  releases 1.2.0: 13 assets present; the assets were not downloaded, so their contents are unchecked

変更後

$ wharfy verify --version 1.2.0
✓ verified releases
  releases 1.2.0: 13 assets present, and all 13 of them hash to what the checksums manifest says (compared against the digests github reports, without downloading them)

--install の実ダウンロードはそのままです。--install が見ているのは、利用者が実際に受け取る バイト列です。突き合わせる相手が無い Release(checksums を持たない BYO 経路)は、従来どおり probe で止めます。

直したこと

入れ方

brew upgrade wharfy / scoop update wharfy / go install github.com/ShiroDoromoto/wharfy/cmd/wharfy@latest。Linux は apt / yum リポジトリから。