feat(backend): ATTESTATION material type - #727
Conversation
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
|
Marking as draft, as I still want to add some tests for the digests. |
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
migmartri
left a comment
There was a problem hiding this comment.
looking good!
Just added some comments so far with some of my concerns, will do a more complete review soon.
Thank you!!
| // see tests for examples | ||
| func extractReferrers(att *dsse.Envelope) ([]*Referrer, error) { | ||
| _, h, err := jsonEnvelopeWithDigest(att) | ||
| _, h, err := materials.JsonEnvelopeWithDigest(att) |
There was a problem hiding this comment.
We could merge this but right after this, we could do a follow up to handle these kind of attestations to make sure they are not injected in the graph.
That said, it's not trivial and not worth being added in this patch.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
migmartri
left a comment
There was a problem hiding this comment.
I have mixed feelings about changing the upload calls but there is nothing wrong with it.
I left some comments to get your take, if you want, feel free to merge. Thanks!
| if tc.wantErr == "" { | ||
| uploader.On("UploadFile", context.TODO(), tc.filePath). | ||
| uploader.On("Upload", context.TODO(), mock.Anything, | ||
| "sha256:c27087147fa040909e0ef1b522386608af545b0a163c30c9f11c3d753676fa44", filepath.Base(tc.filePath)). |
There was a problem hiding this comment.
why of this specific digest? which one does it correspond?
There was a problem hiding this comment.
update: I understand now, this is because now we are using upload not upload file
For this, since you do not care about the case when the upload fails, you can just add mock.anything in the digest arg.
| l.Debug().Str("backend", backend.Name).Msg("uploading") | ||
|
|
||
| _, err = backend.Uploader.UploadFile(ctx, artifactPath) | ||
| _, err := backend.Uploader.Upload(ctx, buf, hash, filename) |
There was a problem hiding this comment.
I am not 100% about these changes. Especially the fact that the content and the ahs are now separate. I am wondering if an alternative less optimal, but that will require less changes would have been to store the content in a temporary file. Not sure, I'd love to get your take
There was a problem hiding this comment.
Taking into account that the grunt of these changes are because of we want to provide some modified versions of a provided file, an alternative, would have been to during the attestation material craft, take the resulted marshalled data and store it in a temporary file and use that one instead.
Then, the rest of the code wouldn't have changed.
There was a problem hiding this comment.
Yes, cleaner for sure. Let me refactor a little bit the change.
|
btw, have you tested this and see what's the result in the index? For future PRs, it would be great if you could add some snippets, demos of the functionality when possible. Thanks! |
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
|
I am having some issues while running it locally |
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
|
Thanks, @migmartri. Fixed! |
This PR adds a new ATTESTATION material type to allow cross-linking different workflow runs using existing attestations.
This is what the logic do:
References #719