Skip to content

fix(install): detect github attestations provenance at lock-time#8781

Closed
hoechenberger wants to merge 3 commits intojdx:mainfrom
hoechenberger:gh-provenance
Closed

fix(install): detect github attestations provenance at lock-time#8781
hoechenberger wants to merge 3 commits intojdx:mainfrom
hoechenberger:gh-provenance

Conversation

@hoechenberger
Copy link
Copy Markdown

Add GithubAttestations to detect_provenance_type() using aqua registry metadata (github_artifact_attestations config). This allows mise lock to record provenance for tools like gh, jq, uv that use GitHub artifact attestations, so mise install --locked skips redundant API calls (which previously caused rate limit failures).

Previously, detect_provenance_type() explicitly skipped GithubAttestations because it "requires downloading the artifact to query the attestation API". However, the aqua registry already has the necessary metadata (enabled flag, signer_workflow) available at lock time — detection does not require verification. This is consistent with how SLSA, cosign, and minisign provenance types are already detected from registry config.

Fixes the issue reported in #8677 (reply in thread)

Commit content and message were created with Claude Opus 4.6.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the mise tool's provenance detection mechanism by enabling the identification of GitHub artifact attestations during the lockfile generation process. This change optimizes the installation workflow for tools utilizing GitHub attestations by pre-recording provenance information, thereby eliminating redundant API calls and mitigating rate limiting issues during subsequent locked installations.

Highlights

  • GitHub Attestations Detection: Modified detect_provenance_type to identify GithubAttestations at the mise lock stage, leveraging existing aqua registry metadata.
  • Performance Improvement: Enabled mise install --locked to skip redundant GitHub API calls for attestation verification, preventing potential rate limit issues.
  • Provenance Priority: Established GithubAttestations as the highest-priority provenance type for detection, followed by SLSA, Cosign, and Minisign.
  • New Test Coverage: Introduced an end-to-end test to validate that mise lock correctly records github-attestations provenance and that mise install --locked bypasses unnecessary verification.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the mise tool's provenance handling by enabling the detection and recording of github-attestations provenance in the lockfile during the mise lock command. This updates the detect_provenance_type logic in src/backend/aqua.rs to prioritize GithubAttestations over other provenance types like SLSA, Cosign, and Minisign. A new end-to-end test has been added to e2e/lockfile/test_lockfile_github_attestations_provenance to verify that mise lock correctly records github-attestations and that subsequent mise install --locked operations skip redundant attestation verification, improving performance. There is no feedback to provide.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 26, 2026

Greptile Summary

This PR extends detect_provenance_type() in src/backend/aqua.rs to detect GithubAttestations provenance at lock-time using aqua registry metadata (github_artifact_attestations config), rather than only recording it after successful install-time verification. This means mise lock can now write provenance = "github-attestations" to the lockfile upfront, letting mise install --locked skip the attestation API call entirely (relying on the lockfile checksum for integrity), which resolves the rate-limit failures described in the linked discussion.

Key changes:

  • detect_provenance_type() now checks for github_artifact_attestations first, matching the ProvenanceType priority order: GithubAttestations (3) > Slsa (2) > Cosign (1) > Minisign (0). This is a priority flip from the previous behaviour where SLSA was the highest priority detectable at lock-time — any package that supports both mechanisms will now record github-attestations instead of slsa on re-lock.
  • The att.enabled != Some(false) guard is consistent with the install-time verify_github_artifact_attestations logic, which treats an absent enabled field as enabled.
  • An e2e test exercises the full lock → install flow with jq 1.8.1, asserting the lockfile records the expected provenance and that the subsequent --locked install doesn't emit the attestation-verification progress message.

Confidence Score: 5/5

Safe to merge — the logic change is small, correct, and consistent with existing provenance-detection patterns.

No P0 or P1 issues found. The core change correctly mirrors the SLSA/Cosign/Minisign detection approach, the enabled-field guard is consistent with install-time verification, and the priority ordering matches the existing ProvenanceType ordinal values. The only remaining concern (fragile shell quoting in the e2e test) was already flagged in a prior review thread and does not affect production correctness.

e2e/lockfile/test_lockfile_github_attestations_provenance — the assert_not_contains shell-quoting issue noted in a prior review comment is still present.

Important Files Changed

Filename Overview
src/backend/aqua.rs Adds GithubAttestations detection to detect_provenance_type() using registry metadata; logic is consistent with existing SLSA/Cosign/Minisign patterns and the enabled-field guard matches the install-time check.
e2e/lockfile/test_lockfile_github_attestations_provenance New e2e test covering lock + locked-install flow for jq 1.8.1; the assert_not_contains invocation uses fragile shell quoting (already flagged in prior review thread).

Sequence Diagram

sequenceDiagram
    participant User
    participant mise
    participant AquaRegistry
    participant GitHubAPI

    Note over User,GitHubAPI: mise lock (before this PR)
    User->>mise: mise lock
    mise->>AquaRegistry: fetch package metadata
    AquaRegistry-->>mise: github_artifact_attestations config
    mise->>mise: detect_provenance_type() → None (skipped)
    mise-->>User: lockfile with checksum only

    Note over User,GitHubAPI: mise install --locked (before this PR)
    User->>mise: mise install --locked
    mise->>mise: has_lockfile_integrity = false (no provenance)
    mise->>GitHubAPI: verify_github_artifact_attestations()
    GitHubAPI-->>mise: rate limit error ❌

    Note over User,GitHubAPI: mise lock (after this PR)
    User->>mise: mise lock
    mise->>AquaRegistry: fetch package metadata
    AquaRegistry-->>mise: github_artifact_attestations config
    mise->>mise: detect_provenance_type() → GithubAttestations ✓
    mise-->>User: lockfile with checksum + provenance="github-attestations"

    Note over User,GitHubAPI: mise install --locked (after this PR)
    User->>mise: mise install --locked
    mise->>mise: has_lockfile_integrity = true (checksum + provenance)
    mise->>mise: ensure_provenance_setting_enabled()
    mise-->>User: install complete (no GitHub API call) ✓
Loading

Reviews (4): Last reviewed commit: "Merge branch 'main' into gh-provenance" | Re-trigger Greptile

Comment thread e2e/lockfile/test_lockfile_github_attestations_provenance Outdated
Add GithubAttestations to detect_provenance_type() using aqua registry
metadata (github_artifact_attestations config). This allows `mise lock`
to record provenance for tools like gh, jq, uv that use GitHub artifact
attestations, so `mise install --locked` skips redundant API calls
(which previously caused rate limit failures).

Previously, detect_provenance_type() explicitly skipped GithubAttestations
because it "requires downloading the artifact to query the attestation
API". However, the aqua registry already has the necessary metadata
(enabled flag, signer_workflow) available at lock time — detection does
not require verification. This is consistent with how SLSA, cosign, and
minisign provenance types are already detected from registry config.
@hoechenberger
Copy link
Copy Markdown
Author

hoechenberger commented Mar 31, 2026

@jdx I know you're very busy these days. Please let me know if there's any way in which I can make the PR review easier or help to hopefully get this fix evaluated & merged soon. This one is a really important one that seems to affect a bunch of users using locked mode with artifacts downloaded from GH :)

@jdx
Copy link
Copy Markdown
Owner

jdx commented Mar 31, 2026

I'm holding off on merging this until the underlying security issue is resolved.

The PR itself doesn't introduce the problem — it follows the same pattern already used by SLSA, cosign, and minisign. But it extends the gap to GitHub attestations, which were previously verified at install-time.

The core issue: mise lock records provenance based purely on aqua registry metadata (detection), but no actual cryptographic verification happens. Then mise install sees the lockfile has both a checksum and provenance entry and skips verify_provenance() entirely (src/backend/aqua.rs:997-1011). This means provenance is never actually verified in the mise lockmise install flow — for any provenance type, not just GitHub attestations.

Provenance is supposed to verify that an artifact was built by a trusted CI pipeline, not just that it hasn't been tampered with since lock-time. If the registry or download source is compromised at lock-time, both the checksum and the unverified provenance field get written to the lockfile without any validation.

This needs to be fixed before we add more provenance types to the lock-time detection path. Possible approaches:

  • mise lock actually verifies provenance (at least for the current platform)
  • mise install --locked still verifies provenance even when the lockfile has a provenance entry
  • Provenance recorded at lock-time is marked as "unverified" and verified on first install

Under paranoid mode, we could modify this behavior to:

  • mise install always verifies provenance at install-time regardless of what the lockfile contains, rather than trusting the lockfile's provenance field as proof of prior verification
  • mise lock downloads and verifies provenance for all platforms, not just the current one

This comment was generated by Claude Code.

@hoechenberger
Copy link
Copy Markdown
Author

  • mise lock actually verifies provenance (at least for the current platform)

I’m in favor of that approach.

If we adopt it, then during mise i --locked we could reasonably rely on the checksums alone, right?

The main motivation for skipping provenance checks at install time is to avoid repeatedly hitting GitHub API endpoints.
During the locking phase, we can assume the user has a GitHub API token configured (or is prepared to deal with rate limits), since updating the lockfile is an intentional action.

However, for consumers of the lockfile – in my case, this would be our developers and end users – verifying the checksum should be sufficient, without requiring additional provenance checks.

Is there any way in which I can help you resolve this issue, or at least test if and how certain approaches would work in our concrete dev & CI setup?

Thank you,
Richard

@jdx jdx marked this pull request as draft April 4, 2026 16:03
jdx added a commit that referenced this pull request Apr 4, 2026
…attestations at lock time

Previously, detect_provenance_type() recorded provenance from registry metadata
without cryptographic verification, and mise install --locked skipped
verify_provenance() entirely when the lockfile had both checksum and provenance.
This meant provenance was never actually verified in the lock→install flow.

This adds a locked_verify_provenance setting (default: false, auto-enabled under
MISE_PARANOID) that forces re-verification at install time even when the lockfile
has provenance. Also enables GitHub artifact attestations as the highest-priority
provenance detection at lock time, and applies the same fix to the github backend.

Closes the security gap discussed in #8781.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jdx jdx closed this Apr 4, 2026
jdx added a commit that referenced this pull request Apr 4, 2026
…attestations at lock time (#8901)

## Summary

**Lock-time verification (current platform):**
- During `mise lock`, for the current platform, downloads the artifact
to a temp directory and runs full cryptographic verification (GitHub
attestations, SLSA, cosign, minisign) before recording provenance in the
lockfile
- Cross-platform entries still use detection-only (registry metadata)
since we can't easily verify artifacts for other platforms
- If verification fails, provenance is not recorded (warning logged)

**Install-time re-verification setting:**
- Adds `locked_verify_provenance` setting
(`MISE_LOCKED_VERIFY_PROVENANCE`, default: false, auto-enabled under
`MISE_PARANOID`) that forces provenance re-verification at install time
even when the lockfile already has both checksum and provenance

**GitHub attestations at lock time:**
- Enables GitHub artifact attestations as highest-priority provenance
detection in `detect_provenance_type()` (what #8781 intended)
- Applies the same `force_verify` logic to both `aqua` and `github`
backends

**Security context:** Previously, `detect_provenance_type()` recorded
provenance from aqua registry metadata without cryptographic
verification, and `mise install --locked` skipped `verify_provenance()`
entirely when the lockfile had both checksum and provenance. This meant
provenance was never actually verified in the `mise lock` → `mise
install` flow. Lock-time verification for the current platform closes
this gap, and the `locked_verify_provenance` setting provides additional
protection for paranoid users.

Supersedes #8781 — incorporates the GitHub attestations detection change
while addressing the underlying security gap discussed there.

## Test plan

- [ ] Verify `cargo check` passes (confirmed locally)
- [ ] Verify `mise lock` records `github-attestations` provenance for
tools with `github_artifact_attestations` in aqua registry (e.g., `jq >=
1.8.0`) after downloading and verifying the artifact
- [ ] Verify `mise lock` logs verification activity for current platform
tools with provenance
- [ ] Verify `mise install --locked` skips provenance verification by
default (existing behavior preserved)
- [ ] Verify `MISE_LOCKED_VERIFY_PROVENANCE=1 mise install --locked`
re-verifies provenance at install time
- [ ] Verify `MISE_PARANOID=1 mise install --locked` also re-verifies
provenance
- [ ] Verify cross-platform lock entries still get provenance from
metadata detection (no download)
- [ ] Verify the new setting appears in `mise settings ls` and schema

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes tool provenance verification behavior in the `aqua` and
`github` backends, including new lock-time artifact downloads and
optional install-time re-verification, which could affect install/lock
reliability and CI rate limits.
> 
> **Overview**
> **Strengthens lockfile provenance semantics.** `mise lock` now
*cryptographically verifies* detected provenance for the **current
platform** (downloading the artifact to a temp dir) before writing
provenance into `mise.lock` for both `aqua` and `github`; if
verification fails, provenance is omitted so it will be verified later.
> 
> **Adds an opt-in install-time safety check.** Introduces
`locked_verify_provenance` (also enabled by `paranoid`) to force
provenance re-verification during `mise install` even when the lockfile
already contains checksum+provenance, and updates schema/docs
accordingly.
> 
> **Test/docs updates.** E2E tests are adjusted for the new npm
package-manager env var and for updated provenance expectations, and the
cosign verification test now uses an aqua package with bundle-based
cosign verification.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
810ef29. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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.

2 participants