Loading
feat(attestations): add ListSigningCertificates
What does this MR do and why?
Adds AttestationsService.ListSigningCertificates, which wraps
List all signing certificates
(GET /projects/:id/attestations/signing_certificates, new in GitLab 19.6). It returns the unexpired certificate
authority (CA) certificates of a project, active and inactive, as []*SigningCertificate, and takes
ListSigningCertificatesOptions for page and per_page.
The GitLab CLI needs it to verify LOCAL_CA attestations: glab attestation verify will build its trusted root
from these certificates. The docs say to trust all of them, including inactive ones, so the method returns both.
Is this a breaking change?
No. It adds one method and two types.
How to validate
make reviewablepasses.make generateonly regeneratestesting/attestations_mock.go.- The new
TestListSigningCertificateschecks the path, thepageandper_pagequery, and all five fields for an inactive and an active certificate. - On GitLab.com,
ListSigningCertificatesfor project 72356192 returns an empty list. - On a local GitLab with the feature flag on,
ListSigningCertificates(paged through withScanAndCollect) returns the project CA. ItsExpiresAtmatches theNotAfterof the parsed PEM certificate. - No integration test: the endpoint needs GitLab Ultimate and the
slsa_provenance_statementfeature flag, and a project only gets a signing certificate after a pipeline signs aLOCAL_CAattestation, which thegitlab_testinstance cannot do.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/603915
- gitlab-org/gitlab!268757 (merged) (signing certificates endpoint)
- https://docs.gitlab.com/api/attestations/#list-all-signing-certificates
- Related: !3182 (merged) (adds
Attestation.SigningMethod, independent of this MR)