Skip to content

Check build provenance in proofline update with PROOFLINE_VERIFY_PROVENANCE=1 - #73

Open
rodriwp wants to merge 1 commit into
prooflinedev:mainfrom
rodriwp:update-verify-provenance
Open

rodriwp wants to merge 1 commit into
prooflinedev:mainfrom
rodriwp:update-verify-provenance

Conversation

@rodriwp

@rodriwp rodriwp commented Nov 20, 2026

Copy link
Copy Markdown

Who this helps

People who keep the CLI current with proofline update. #72 lets the installer check the archive's build provenance. Self-update has the same gap, and people run it far more often than the installer:

  • install() reads the version from proofline.sh/cli/latest, then downloads SHA256SUMS and the archive from the same origin. Anyone who can write the bucket controls all three, so the checksum still passes on a replaced archive.
  • The release job already attests every archive (actions/attest in release.yml), but nothing checks it.

What it adds

PROOFLINE_VERIFY_PROVENANCE=1 proofline update behaves like the installer in #72:

  • The same check. After the existing SHA256SUMS check and before replace, it writes the downloaded bytes to a private temporary directory and runs gh attestation verify with --hostname github.com --repo prooflinedev/cli --deny-self-hosted-runners and an identity pinned to release.yml at refs/tags/v<version> or refs/heads/main. gh checks the same bytes that are installed next.
  • The tag ties latest to what GitHub signed. If the bucket's latest names a version, the archive must be the one the release workflow built at that version's tag. Together with the existing newer() check, an older genuine build can't be passed off as a newer one.
  • It fails closed in the same places. gh is resolved once from PATH, as an executable file under an absolute directory, before any download, so if it's missing nothing is downloaded. A failed check keeps the installed binary. Any value other than 1, 0 or unset is refused. I didn't use clap's boolish env parsing on purpose, because it would accept yes and on while the installer doesn't.
  • No new dependencies. It uses std::process::Command, which update.rs already uses, and tempfile. Without the setting, update is unchanged. Windows is unaffected because self-update doesn't install Windows binaries.

Tests

Added to src/update/tests.rs:

  • Only 1 or 0 is accepted; yes, true, on, 1 and 2 are refused.
  • The identity regex is checked exactly for 0.3.9.
  • find_program returns only executable regular files on absolute PATH entries. Directories, non-executable files and relative entries are skipped.
  • With a passing stand-in gh, the binary is replaced. The test checks the exact arguments and that gh received byte-identical archive contents.
  • With a failing gh, the installed binary is kept and the error says "nothing was installed".
  • A checksum mismatch stops before gh runs.

Each test fails when its rule is removed: dropping --deny-self-hosted-runners, accepting yes, loosening heads/main, or skipping the executable-bit check.

End to end with the real gh and the live release: I built this branch with its version set to 0.3.0 and installed it in a throwaway installer directory.

  • PROOFLINE_VERIFY_PROVENANCE=1 proofline update verified and updated it to 0.3.9. The result is byte-identical to the official aarch64-apple-darwin binary.
  • Without gh on PATH, and with PROOFLINE_VERIFY_PROVENANCE=yes, it exited 1 and kept 0.3.0.

cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo test --locked pass. The exception is agent_install::unattended_registration_preserves_settings_and_uses_the_installed_binary, which fails the same way on an unmodified main on my macOS machine.

Notes

This branch has not been deployed

No deployments
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