fix(aqua): support GitHub attestation predicate fields#10169
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for predicate_type in GitHub artifact attestations, allowing more granular filtering during verification. It also deprecates the signer-workflow field in favor of signer_workflow with a fallback getter, and updates the sigstore integration to use AttestationClient directly. A review comment suggests simplifying the merge logic for the deprecated and new signer_workflow fields in crates/aqua-registry/src/types.rs using Option::or.
Greptile SummaryThis PR adds support for the
Confidence Score: 5/5This PR is safe to merge — changes are well-scoped, each new code path has a corresponding test, and the existing behaviour when predicate_type is absent is preserved by explicit delegation to the original functions. All four changed files make consistent, additive changes. Detection and verification both fall through to the existing unfiltered logic when no predicate type is configured. The versions-host bypass is correctly scoped to the predicate-present branch. Unit tests cover both the URL construction and the YAML deserialization round-trip. No logic errors or missing guards were found. No files require special attention. Important Files Changed
Reviews (5): Last reviewed commit: "fix(aqua): support GitHub attestation pr..." | Re-trigger Greptile |
8f95747 to
4125e10
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds optional ChangesPredicate Type Support for GitHub Artifact Attestations
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
4125e10 to
428dfa5
Compare
428dfa5 to
00c6b09
Compare
|
This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically. This is warning day 1 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically. This is warning day 2 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
Summary
github_artifact_attestations.predicate_typeField References
github_artifact_attestationsdocs: https://aquaproj.github.io/docs/reference/registry-config/github-artifact-attestations/predicate_type: https://pkg.go.dev/github.com/aquaproj/aqua/v2/pkg/config/registry#GitHubArtifactAttestationspredicate_typequery filter: https://docs.github.com/en/rest/orgs/attestations?apiVersion=2022-11-28#list-attestationsgh attestation verify --predicate-type: https://cli.github.com/manual/gh_attestation_verifyPackages Using This Field
Current aqua-registry entries using
github_artifact_attestations.predicate_type:foundry-rs/foundry: https://github.com/aquaproj/aqua-registry/blob/main/pkgs/foundry-rs/foundry/registry.yaml#L41-L43https://spdx.dev/Document/v2.3gleam-lang/gleam: https://github.com/aquaproj/aqua-registry/blob/main/pkgs/gleam-lang/gleam/registry.yaml#L143-L145 and https://github.com/aquaproj/aqua-registry/blob/main/pkgs/gleam-lang/gleam/registry.yaml#L162-L164https://spdx.dev/Document/v2.3SPDX SBOM vs SLSA Provenance
SPDX is a standard Software Bill of Materials format. An SPDX SBOM answers "what is in this artifact?" It lists package/component metadata such as dependencies, versions, relationships, licenses, and related identifiers. The predicate value
https://spdx.dev/Document/v2.3identifies an in-toto/GitHub attestation whose predicate payload is an SPDX 2.3 document.SLSA provenance answers "where and how did this artifact come from?" It describes the source, builder, workflow, build inputs, and build parameters for an artifact. The common GitHub provenance predicate is
https://slsa.dev/provenance/v1.Short version: SPDX SBOM is inventory; SLSA provenance is build origin.
Why Foundry and Gleam Use SPDX Here
Both package entries point at release workflows that generate SBOMs and create GitHub artifact attestations with an SBOM payload. That means the attestation the registry is asking aqua/mise to verify is specifically an SPDX SBOM attestation, not the default SLSA provenance attestation.
This does not mean SLSA is unimportant or unavailable. It means this particular aqua registry field is being used to select the SBOM attestation for the release archive. Foundry also has a separate generic/provenance-style attestation step, but the aqua registry entry explicitly configures the SPDX predicate for the archive SBOM attestation.
Why aqua Supports This
GitHub artifact attestations are not limited to SLSA provenance. GitHub's API and
gh attestation verifyboth accept a predicate type filter so callers can select provenance, SBOM, release, or custom predicate attestations. aqua exposespredicate_typeso registry entries can preserve that upstream verification policy instead of hard-coding one attestation kind.Why mise Needs This
mise consumes aqua-registry metadata. If mise ignores
predicate_type, it cannot faithfully implement the registry's requested verification policy for packages like Foundry and Gleam.Before this PR,
predicate_typewas not parsed or sent to GitHub. For these packages, mise treated GitHub artifact attestation verification as "find any valid attestation for this artifact and signer workflow." That could pass by verifying a different predicate type when multiple attestations exist, or pass an SPDX attestation only accidentally because the unfiltered API result happened to include it. It did not enforce "verify the SPDX SBOM attestation" as requested by aqua-registry.This PR changes that behavior by sending
predicate_typeto GitHub during detection and verification. Because mise's versions-host attestation cache is keyed by digest only, predicate-filtered requests bypass that cache and query GitHub directly.Tests
mise run format(includescargo check --all-features)cargo test -p aqua-registry test_github_artifact_attestations_predicate_type -- --nocapturecargo test -p mise-sigstore attestations_url_includes_predicate_type -- --nocapturegit diff --checkSummary by CodeRabbit
New Features
Tests