Add signing certificates endpoint to attestations API

What does this MR do and why?

Adds GET /projects/:id/attestations/signing_certificates, which returns the unexpired certificate authority (CA) certificates of a project as PEM. LOCAL_CA attestation bundles have no Rekor entry, so cosign needs the project CA as the trust anchor (cosign trusted-root create, then verify-blob-attestation --trusted-root). Today the certificate is only reachable from a Rails console. glab attestation verify will use this endpoint, and users can download the certificates once for offline verification.

  • Returns active and inactive certificates, so attestations signed before a future CA rotation stay verifiable. Expired certificates are left out: the driver only issues a leaf when the CA outlives it, so an expired CA has no valid leaves left.
  • Exposes only id, certificate, active, expires_at, and created_at. The private key is never exposed (the spec asserts it).
  • Same gates as the other attestation endpoints: the slsa_provenance_statement feature flag (404 when off), read_attestation, and granular token authorization. Marked route_setting :lifecycle, :experiment.
  • Regenerates the OpenAPI v3 definition and the fine-grained token REST docs.

Stacked on !268753 (merged), which adds the not_expired scope and carries the query plan.

References

Screenshots or screen recordings

Screenshot 2026-11-11 at 11.01.07 AM.png

How to set up and validate locally

  1. Enable the flag for a project in the Rails console: Feature.enable(:slsa_provenance_statement, Project.find(ID))
  2. Run a pipeline with ATTEST_METHOD: LOCAL_CA so the project gets a CA, or use a project that already has LOCAL_CA attestations.
  3. Run curl --request GET --header "PRIVATE-TOKEN: <token>" --url "http://gdk.test:3000/api/v4/projects/ID/attestations/signing_certificates".
  4. Compare the returned certificate with SupplyChain::PostgresCaDriver.new(Project.find(ID)).ca_certificate.to_pem in the Rails console.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Saahil Sabu Hameed

Merge request reports

Loading
Loading