feat(attestation): allow runtime annotations - #281
Merged
Conversation
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support providing "attestation-time" material annotations.
For example, let's say that we have this contract
{ "schemaVersion": "v1", "materials": [ { "type": "SBOM_CYCLONEDX_JSON", "name": "skynet-sbom", "annotations": [ { "name": "component", "value": "controlplane" } ] }, { "type": "CONTAINER_IMAGE", "name": "image", "annotations": [ { "name": "component" } ] }, { "type": "STRING", "name": "string" } ] }Note how the material called
imageis defining acomponentannotation but is not setting its value.If you try to add the material without the annotation it will fail.
$ chainloop att add --name image --value ghcr.io/chainloop-dev/chainloop/control-plane ERR adding material: annotations ["component"] not providedIf you try to add an annotation not defined in the contract it will fail too
or an invalid annotation
$ chainloop att add --name image --value ghcr.io/chainloop-dev/chainloop/control-plane --annotation foo ERR invalid annotation "foo", the format must be key=valuebut otherwise it can be set
The result ends in the attestation as expected
[ { "annotations": { "chainloop.material.name": "image", "chainloop.material.type": "CONTAINER_IMAGE", "component": "test" // IMPORTANT: Added on the fly }, "digest": { "sha256": "97deaf8ad2e31524d6e7eee65468a4330cb55f7dcf4911ebdf2a580a4261c006" }, "name": "ghcr.io/chainloop-dev/chainloop/control-plane" }, { "annotations": { "chainloop.material.cas": true, "chainloop.material.name": "skynet-sbom", "chainloop.material.type": "SBOM_CYCLONEDX_JSON", "component": "controlplane" // IMPORTANT: Added by the contract }, "digest": { "sha256": "ebe2e6ffab93f4b2e2743d3557bd094427ea059adc78cfe2cd330a72f61731e8" }, "name": "sbom.cp.cyclonedx.json" }, { "annotations": { "chainloop.material.name": "string", "chainloop.material.type": "STRING" }, "content": "dGVzdA==" } ]Refs #252