Skip to content

feat(cli): add Sigstore/SLSA provenance verification to Rust self-update#7818

Merged
jamadeo merged 6 commits intoblock:mainfrom
fresh3nough:fix/update-checksum-verification-7552
Mar 19, 2026
Merged

feat(cli): add Sigstore/SLSA provenance verification to Rust self-update#7818
jamadeo merged 6 commits intoblock:mainfrom
fresh3nough:fix/update-checksum-verification-7552

Conversation

@fresh3nough
Copy link
Copy Markdown
Contributor

Summary

Replace the custom SHA-256/.sha256 checksum approach with Sigstore SLSA provenance verification using the sigstore-verification crate. Leverages the SLSA attestations from actions/attest-build-provenance added in #7097 and builds on the native Rust self-update foundation from #7148.

Supersedes #7575 with the direction suggested by @tlongwell-block (sigstore-rs verification instead of custom checksums).

Changes

Sigstore provenance verification:

  • After downloading the release archive, verify_provenance() computes its SHA-256 digest, writes to a temp file, and calls sigstore_verification::verify_github_attestation() to fetch and verify the GitHub attestation bundle
  • Verifies the Sigstore signature chain, Rekor transparency log inclusion, and artifact digest match
  • Selects the correct workflow (release.yml or canary.yml) based on the update channel
  • Supports optional GITHUB_TOKEN/GH_TOKEN env var for higher rate limits
  • Graceful degradation: warns but proceeds if attestation is not found (for pre-Add SLSA build provenance attestations to release workflows #7097 releases)

Extraction hardening (kept from #7575):

  • Tar extraction (tar.bz2) now iterates entries individually, rejecting any entry whose path is absolute or contains .. components (tar-slip protection)
  • Zip extraction uses enclosed_name() for path sanitization and iterates entries individually (zip-slip protection)
  • Parent directories are created per-entry during tar extraction

Dependencies added:

  • sigstore-verification = "0.1" (wraps sigstore-rs for GitHub attestation verification)
  • sha2 = "0.10" (SHA-256 digest computation)

Type of Change

  • Security fix
  • Tests

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

  • 16 unit tests covering:
    • SHA-256 digest computation (known value + empty input)
    • Path validation (safe paths, absolute path rejection, traversal rejection, nested traversal)
    • tar.bz2 extraction round-trip with hardened extractor
    • Binary location in various archive layouts
    • Binary replacement
    • Provenance verification graceful degradation (unattested artifact)
  • All tests pass: cargo test -p goose-cli -- update (16/16)
  • cargo clippy -p goose-cli --all-targets -- -D warnings passes clean
  • cargo fmt applied
source bin/activate-hermit
cargo build -p goose-cli
cargo test -p goose-cli -- update
cargo clippy -p goose-cli --all-targets -- -D warnings

Related Issues

Closes #7552
Supersedes #7575

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ce7586b62

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e827d0751

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@fresh3nough fresh3nough force-pushed the fix/update-checksum-verification-7552 branch from 2e827d0 to badd382 Compare March 12, 2026 21:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: badd382d12

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown
Collaborator

@jamadeo jamadeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@jamadeo jamadeo enabled auto-merge March 18, 2026 20:02
auto-merge was automatically disabled March 18, 2026 20:16

Head branch was pushed to by a user without write access

@fresh3nough fresh3nough force-pushed the fix/update-checksum-verification-7552 branch from 886a06a to d65914d Compare March 18, 2026 20:16
@fresh3nough
Copy link
Copy Markdown
Contributor Author

fixed the merge conflicts

@jamadeo jamadeo enabled auto-merge March 18, 2026 20:17
auto-merge was automatically disabled March 18, 2026 20:50

Head branch was pushed to by a user without write access

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af43087abf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@fresh3nough fresh3nough force-pushed the fix/update-checksum-verification-7552 branch 2 times, most recently from 4b492c3 to 38219e7 Compare March 18, 2026 23:23
Replace custom SHA-256 checksum approach with Sigstore provenance verification
using the sigstore-verification crate. Leverages the SLSA attestations from
actions/attest-build-provenance added in block#7097 and builds on the native Rust
self-update foundation from block#7148.

Changes:
- Add verify_provenance() that fetches and verifies GitHub attestation bundles
  via the sigstore-verification crate (Sigstore signature chain, Rekor
  transparency log, artifact digest match)
- Harden tar.bz2 extraction against tar-slip (reject absolute paths and ..
  components, create parent dirs per-entry)
- Harden zip extraction against zip-slip (use enclosed_name() sanitization,
  iterate entries individually)
- Add sha256_hex() helper for archive digest computation and display
- Remove all .sha256 file download/verify logic and CI workflow changes
- 16 unit tests covering SHA-256 digests, path validation (safe paths,
  absolute path rejection, traversal rejection, nested traversal), tar
  extraction round-trip, binary location, binary replacement, and provenance
  verification graceful degradation

Signed-off-by: fre$h <[email protected]>
Signed-off-by: fre <[email protected]>
…k escapes

- Switch sigstore-verification to rustls (default was native-tls, blocked by check-no-native-tls.sh)
- Hard-error on AttestationError::Verification; soft-warn only for NoAttestations and network failures
- Validate symlink/hardlink targets in extract_tar_bz2 via existing validate_entry_path
- Add test: test_extract_tar_bz2_blocks_symlink_escape

Signed-off-by: fre <[email protected]>
…rgets

entry.header().link_name() only reads the fixed header field, which can
be truncated or bypassed when the real link target is stored in GNU/PAX
extended metadata (linkpath). Use entry.link_name() so the validated
path matches what entry.unpack() will actually use.

Signed-off-by: fre <[email protected]>
verify_provenance now returns Result<bool>: Ok(true) for full
attestation verification, Ok(false) for soft-warn paths (no
attestation found, transient network errors), Err for active
verification failures.

update() uses the bool to print either:
  "goose updated successfully (verified with Sigstore SLSA provenance)."
  "goose updated successfully."

This prevents misleading users when verification was skipped rather
than completed.

Signed-off-by: fre <[email protected]>
@fresh3nough fresh3nough force-pushed the fix/update-checksum-verification-7552 branch from 38219e7 to 7bd36cf Compare March 19, 2026 13:33
@jamadeo jamadeo added this pull request to the merge queue Mar 19, 2026
Merged via the queue into block:main with commit a68c678 Mar 19, 2026
21 checks passed
cloorc pushed a commit to LeafAI/Leaf that referenced this pull request Mar 20, 2026
cloorc pushed a commit to LeafAI/Leaf that referenced this pull request Mar 20, 2026
elijahsgh pushed a commit to elijahsgh/goose that referenced this pull request Mar 21, 2026
elijahsgh pushed a commit to elijahsgh/goose that referenced this pull request Mar 21, 2026
@codefromthecrypt
Copy link
Copy Markdown
Collaborator

codefromthecrypt commented Mar 22, 2026

@jamadeo fyi this is a pretty big dep change and responsible for our current red builds as sigstore-verification depends directly on rsa crate though doesn't use much of it, and rsa has unresolvable vulns

@codefromthecrypt
Copy link
Copy Markdown
Collaborator

#8064 swaps the dep but I can't push it through personally

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.

CLI self-update lacks signature/checksum verification; archive extraction should be hardened

3 participants