Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the SHA256 digest of the intoto payload into the rekor entry #764

Merged
merged 3 commits into from
Apr 8, 2022

Conversation

bobcallaway
Copy link
Member

Currently we are storing the digest over the entire intoto envelope in the corresponding Rekor entry. This PR adds the SHA256 digest for the envelope's payload (the base64 decoded bytes) into the log entry as well.

This also fixes the length check in Attestation to measure against the length of bytes after base64 decoding the payload, instead of the payload itself.

@asraa @haydentherapper @SantiagoTorres

Signed-off-by: Bob Callaway <bcallaway@google.com>
Signed-off-by: Bob Callaway <bcallaway@google.com>
Signed-off-by: Bob Callaway <bcallaway@google.com>
@bobcallaway bobcallaway requested a review from a team as a code owner April 8, 2022 16:35
@codecov-commenter
Copy link

Codecov Report

Merging #764 (39b1a25) into main (3de8b60) will decrease coverage by 0.18%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #764      +/-   ##
==========================================
- Coverage   49.15%   48.96%   -0.19%     
==========================================
  Files          61       61              
  Lines        5566     5577      +11     
==========================================
- Hits         2736     2731       -5     
- Misses       2536     2551      +15     
- Partials      294      295       +1     
Impacted Files Coverage Δ
pkg/types/intoto/v0.0.1/entry.go 33.33% <0.00%> (-2.10%) ⬇️
pkg/types/helm/v0.0.1/entry.go 52.41% <0.00%> (-1.21%) ⬇️
pkg/types/alpine/v0.0.1/entry.go 61.24% <0.00%> (-0.78%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3de8b60...39b1a25. Read the comment docs.

if err != nil {
return nil, errors.Wrap(err, "decoding attestation")
}
attH := sha256.Sum256(decodedAttestation)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you either return an error if a non sha256 algorithm enum is specified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're setting the value, its not user selectable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks good then!

@dlorenc dlorenc merged commit aa5d132 into sigstore:main Apr 8, 2022
@dlorenc
Copy link
Member

dlorenc commented Apr 8, 2022

Nice!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants