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

Allow for option in cosign attest and attest-blob to upload attestation as supported in Rekor #3466

Merged
merged 8 commits into from Jan 13, 2024

Conversation

aalsabag
Copy link
Contributor

@aalsabag aalsabag commented Jan 2, 2024

Resolves sigstore/rekor#1928

Summary
This allows for attestation uploads to S3 if --store-attestation is set. This is only enabled for those running private instances of Rekor.

Release Note
A --store-attestation flag is added to attest and attest-blob to upload the attestation to a third party store (i.e s3) if enabled in a private rekor instance

Documentation
NONE

aalsabag and others added 3 commits December 21, 2023 23:23
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 22 lines in your changes are missing coverage. Please review.

Comparison is base (e678426) 40.09% compared to head (43081c4) 40.07%.
Report is 10 commits behind head on main.

Files Patch % Lines
cmd/cosign/cli/attest/attest.go 0.00% 8 Missing ⚠️
cmd/cosign/cli/attest/attest_blob.go 33.33% 6 Missing ⚠️
cmd/cosign/cli/options/attest.go 0.00% 3 Missing ⚠️
cmd/cosign/cli/options/attest_blob.go 0.00% 3 Missing ⚠️
cmd/cosign/cli/attest.go 0.00% 1 Missing ⚠️
cmd/cosign/cli/attest_blob.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3466      +/-   ##
==========================================
- Coverage   40.09%   40.07%   -0.02%     
==========================================
  Files         155      155              
  Lines        9982    10040      +58     
==========================================
+ Hits         4002     4024      +22     
- Misses       5494     5530      +36     
  Partials      486      486              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
@@ -30,6 +30,7 @@ type AttestOptions struct {
SkipConfirmation bool
TlogUpload bool
TSAServerURL string
StoreAttestation bool
Copy link
Contributor

Choose a reason for hiding this comment

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

hey @aalsabag long time no see. Do we think StoreAttestation is too generic? Maybe StoreInTotoAttestation?

Or how about AttestationType, and it defaults to dsse? I feel like the current name would make me think I need to set the flag when running cosign attest, because I want the attestation stored in rekor, which could lead to a lot of people setting the flag unneccessarily when sending to the public good instance. Thoughts?

@bobcallaway
Copy link
Member

bobcallaway commented Jan 8, 2024

A --store-attestation boolean infers that the client has complete control over this, when in reality both the Rekor type cosign uploads (intoto may store it vs dsse never will) and the server side setting can effect whether this is successful.

IMO, this PR should really be about setting the Rekor type (intoto vs dsse) vs having a carveout for a specific endpoint (rekor.sigstore.dev)

@aalsabag
Copy link
Contributor Author

aalsabag commented Jan 8, 2024

Big dog @nkreiger !

Yeah that's a good point!

To combine both you and @bobcallaway 's comments, I'm thinking of

  1. Changing the flag's name from store-attestation to store-intoto-attestation.
  2. Adding an additional conditional to check to see that the type is "intoto" effectively checking to see that the flag was set, we are uploading an intoto type, and we are pointing to a private rekor instance.
  3. Expanding on the help comment to indicate that the flag "is for those running private instances of rekor with an attestation store backend"

What do y'all think of this?

@haydentherapper
Copy link
Contributor

To @bobcallaway's point, we should avoid referencing storing an attestation in the flag name, because there's no guarantee that an instance of Rekor, public or private, will support uploading the attestations. Even with the proposed documentation for the flag, there would be an expectation from the user that this controls server-side behavior.

I think the flag should be whether to use dsse vs intoto for the Rekor attestation type, and whether or not the log backend stores the attestation is up to the log deployer.

I am in support of restricting it to just private instances though, as this is forward looking to disabling these types in the public instance.

@bobcallaway
Copy link
Member

  1. Adding an additional conditional to check to see that the type is "intoto" effectively checking to see that the flag was set, we are uploading an intoto type, and we are pointing to a private rekor instance.

I don't think you need to check what instance you are pointing to at all. It does make me wonder if Rekor should set a response header if it does not store the attestation.

@haydentherapper
Copy link
Contributor

It depends if the intoto type will be deprecated in favor of the newer type, or if storage would just be disabled for these types. I'm fine with leaving this check out though as we don't have any other examples of a check for private vs public in the code.

The response header would be a nice feature.

@aalsabag
Copy link
Contributor Author

aalsabag commented Jan 9, 2024

I think the flag should be whether to use dsse vs intoto for the Rekor attestation type, and whether or not the log backend stores the attestation is up to the log deployer.

That's fine, but if you guys recall, my original suggestion was to check the type flag which I was told was a bad idea and abandoned in favor of a "new" flag. Are we deprecating this flag entirely? What's its purpose with regards to our attest command?

Anyway, not important at the moment.
Here are some options for a new flag name that doesn't include a reference to storing attestations.

--attestation-type
--upload-type

The type would either be intoto or dsse.

Also, I am with @haydentherapper with regards to keeping the rekor server check for the time being at least until we get some functionality around the response header suggestion, but happy to abandon that too.

@bobcallaway
Copy link
Member

bobcallaway commented Jan 9, 2024 via email

Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
@aalsabag
Copy link
Contributor Author

I've gone ahead and made the update @bobcallaway

bobcallaway
bobcallaway previously approved these changes Jan 12, 2024
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

PTAL at failing tests

Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
Signed-off-by: Ahmed Alsabag <ahmed.alsabag@gmail.com>
@aalsabag
Copy link
Contributor Author

PTAL at failing tests

I think I've fixed them all now.

@bobcallaway bobcallaway merged commit 7b7304c into sigstore:main Jan 13, 2024
28 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Jan 13, 2024
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.

Allow attestation upload for DSSE type similar to the intoto type
5 participants