Modify PublishProvenanceService to persist attestation
Why are we doing this work
In Modify PublishProvenanceService so that it calls cosign, performing attestation., we modified PublishProvenanceService so that it would call the cosign executable with the right parameters. This was done in the attest_blob! method, which returns the Sigstore bundle as a string. At a high level, this bundle is a string that contains all the information to verify the binary.
This issue is about the persistence of this string, alongside other attributes of the attestation. Because Add file uploader for SLSA attestations is not yet merged, work on this ticket can start, but needs to be based on that MR.
Relevant links
- Create database table for SLSA attestations. We can use this model to store attributes of the attestation.
- Add file uploader for SLSA attestations. We need to base our work on this MR.
- [FF]
slsa_provenance_statement-- Roll out feature flag to publish SLSA provenance statements
Non-functional requirements
-
Documentation: N/A -
Feature flag: [FF] slsa_provenance_statement-- Roll out feature flag to publish SLSA provenance statements -
Performance: N/A -
Testing: verifying via logs in production, verifying via console in staging. See Verificationbelow.
Implementation plan
- Modify the
attest!method to, instead of returning aTempfile, upload the file using the new uploader. As discussed in this comment, we need to avoid logging the attestation. More information in "Uploads guide: Adding new uploads". - Associate the newly uploaded file with the
Attestationobject, and persist it by calling save on that object. Specific attributes that need to be populated are within the model itself.
Verification steps
-
Once the code is in production, enable the FF on a project that has all the required pre-requisites. Observe that the logs are correct. -
Once the code is on staging, enable the FF on a project that has all the required pre-requisites and connect to the staging read-only console. Observe the models are correctly populated.
Edited by 🤖 GitLab Bot 🤖