Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromproofline.sh/cli/latest, then downloadsSHA256SUMSand the archive from the same origin. Anyone who can write the bucket controls all three, so the checksum still passes on a replaced archive.actions/attestinrelease.yml), but nothing checks it.What it adds
PROOFLINE_VERIFY_PROVENANCE=1 proofline updatebehaves like the installer in #72:SHA256SUMScheck and beforereplace, it writes the downloaded bytes to a private temporary directory and runsgh attestation verifywith--hostname github.com --repo prooflinedev/cli --deny-self-hosted-runnersand an identity pinned torelease.ymlatrefs/tags/v<version>orrefs/heads/main.ghchecks the same bytes that are installed next.latestto what GitHub signed. If the bucket'slatestnames a version, the archive must be the one the release workflow built at that version's tag. Together with the existingnewer()check, an older genuine build can't be passed off as a newer one.ghis resolved once fromPATH, 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 than1,0or unset is refused. I didn't use clap's boolish env parsing on purpose, because it would acceptyesandonwhile the installer doesn't.std::process::Command, whichupdate.rsalready uses, andtempfile. Without the setting,updateis unchanged. Windows is unaffected because self-update doesn't install Windows binaries.Tests
Added to
src/update/tests.rs:1or0is accepted;yes,true,on,1and2are refused.0.3.9.find_programreturns only executable regular files on absolutePATHentries. Directories, non-executable files and relative entries are skipped.gh, the binary is replaced. The test checks the exact arguments and thatghreceived byte-identical archive contents.gh, the installed binary is kept and the error says "nothing was installed".ghruns.Each test fails when its rule is removed: dropping
--deny-self-hosted-runners, acceptingyes, looseningheads/main, or skipping the executable-bit check.End to end with the real
ghand the live release: I built this branch with its version set to0.3.0and installed it in a throwaway installer directory.PROOFLINE_VERIFY_PROVENANCE=1 proofline updateverified and updated it to 0.3.9. The result is byte-identical to the officialaarch64-apple-darwinbinary.ghonPATH, and withPROOFLINE_VERIFY_PROVENANCE=yes, it exited 1 and kept 0.3.0.cargo fmt --check,cargo clippy --locked --all-targets -- -D warningsandcargo test --lockedpass. The exception isagent_install::unattended_registration_preserves_settings_and_uses_the_installed_binary, which fails the same way on an unmodifiedmainon my macOS machine.Notes
gh, would mean pulling in a Sigstore verifier and its TUF trust root. That's a much larger change, so I've left it out.