Skip to content

Check build provenance in the installer with PROOFLINE_VERIFY_PROVENANCE=1 - #72

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

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

Conversation

@rodriwp

@rodriwp rodriwp commented Nov 20, 2026

Copy link
Copy Markdown

Check build provenance in the installer with PROOFLINE_VERIFY_PROVENANCE=1

Who this helps

People who install the CLI on machines where a replaced binary would matter: CI runners, build hosts, laptops with cloud credentials.

The release job already records SLSA build provenance for every archive (actions/attest in release.yml). For v0.3.9, all five archives carry an attestation signed by prooflinedev/cli/.github/workflows/release.yml@refs/tags/v0.3.9. Nothing checks it yet:

  • install.sh compares the archive with SHA256SUMS, but both files come from the same R2 origin. Anyone who can write the bucket (for example with a leaked CLI_RELEASE_R2_CREDENTIALS) can replace both, and the check still passes.
  • The provenance comes from a different trust root: Sigstore and GitHub's OIDC identity for the release workflow. An R2 write cannot forge it.

What it adds

curl -fsSL https://proofline.sh/cli | PROOFLINE_VERIFY_PROVENANCE=1 sh

With PROOFLINE_VERIFY_PROVENANCE=1, after the existing checksum check and before extracting anything, the installer runs:

gh attestation verify "$archive" \
  --hostname github.com \
  --repo prooflinedev/cli \
  --cert-identity-regex '^https://github\.com/prooflinedev/cli/\.github/workflows/release\.yml@refs/(tags/vX\.Y\.Z|heads/main)$' \
  --deny-self-hosted-runners
  • The signer is pinned to the workflow and the ref, not just the repository. The README says a release is published from its vX.Y.Z tag or by a main dispatch, so only those two refs pass. The tag is the version being installed, so an older, genuine archive served as a newer version fails.
  • It fails closed. If gh is missing, the installer stops before downloading anything, as --setup already does without git. If verification fails, nothing is installed. Any value other than 1, 0 or unset is refused, so a typo can't silently turn the check off.
  • The default is unchanged. Without the variable, the installer behaves exactly as it does today, so this adds no dependency on gh.
  • shellcheck -s sh install.sh is clean.

Tests

install.sh had no tests. tests/install.rs runs the real installer under /bin/sh with a PATH that contains only the tools it uses, a stand-in curl that serves a locally built release, and a stand-in gh. It needs no network and no real GitHub CLI. It covers:

  • the default install, where gh is never called;
  • a verified install, with an exact check of the gh arguments, including the identity regex;
  • failed verification, after which nothing is installed;
  • PROOFLINE_VERIFY_PROVENANCE=1 without gh, which makes zero downloads;
  • an unknown value, which is refused before any download;
  • a checksum mismatch, which stops before gh runs.

I confirmed that each test fails when its rule is removed from install.sh. The tests are #![cfg(unix)], matching the installer.

I also ran the new function against the published v0.3.9 aarch64-apple-darwin archive with the real gh. It passes for 0.3.9 and is rejected when the same archive is claimed as 0.3.8 or 1.3.9.

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

Possible follow-ups (not in this PR)

  • Set PROOFLINE_VERIFY_PROVENANCE=1 in hosted-install.yml, which already has gh. Following the README, I'm suggesting this rather than changing the workflow myself.
  • Give proofline update the same check. In Rust that needs a Sigstore verifier, a larger and separate change.
  • Once the check has run for a while, consider turning it on by default when gh is present and signed in.

@rodriwp

rodriwp commented Nov 20, 2026

Copy link
Copy Markdown
Author

I ran the branch's install.sh against the live releases on proofline.sh (macOS, aarch64-apple-darwin, gh 2.102.0), installing into a throwaway directory:

Case Result
PROOFLINE_VERIFY_PROVENANCE=1, 0.3.9 (the current default) Verified and installed proofline 0.3.9
PROOFLINE_VERIFY_PROVENANCE=1 PROOFLINE_VERSION=0.1.0 Refused: GitHub has no attestation for that digest (HTTP 404). Nothing installed.
PROOFLINE_VERIFY_PROVENANCE=1 with no gh on PATH Refused before any download
PROOFLINE_VERIFY_PROVENANCE=yes Refused: must be 1 or 0

The 0.1.0 row is the useful one. That release predates actions/attest in release.yml: the oldest attested aarch64-apple-darwin archive I found is 0.1.5. Its archive still matches its SHA256SUMS, so today's installer accepts it, but the provenance check doesn't. A replaced archive behaves the same way. Pinning a release older than 0.1.5 with the check on will fail, which I think is the right result. I can add a sentence about it to the README if you'd like.

Separately, I checked the 0.3.9 archive by hand against the wrong versions: it verifies as 0.3.9 and is rejected as 0.3.8 or 1.3.9, so the tag in the identity regex does its job.

The failing "Proofline gate" check says the author needs a Proofline seat, and the Checks workflow is waiting for approval because this is my first contribution.

@rodriwp

rodriwp commented Nov 20, 2026

Copy link
Copy Markdown
Author

Follow-up for proofline update: #73 adds the same opt-in check (PROOFLINE_VERIFY_PROVENANCE=1, same flags and identity) before self-update replaces the binary. It doesn't depend on this PR; only the README paragraphs sit next to each other, so I'll rebase whichever lands second.

@rodriwp

rodriwp commented Nov 20, 2026

Copy link
Copy Markdown
Author

@mohsen1 Hello, Rodrigo here ( everything else was AI as expected). I just make a simple change to avoid malicious actor inserting a compromise binary. These days this simple stuff can protect you from bigger issues.

I will try to find some time to build some stronger feature as well, but I though this quick one would be useful

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