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

expand oci-image-verification example for private infra #321

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

dmitris
Copy link
Contributor

@dmitris dmitris commented Oct 22, 2024

Summary

PR expands the oci-image-verification example with additional options for running it in a "private infrastructure" environment and to allow to extract non-Rekor-based timestamps from the OCI image being verified.

This is done in the mode of exploring the sigstore-go library and for now is a Draft - but I would appreciate any comments especially on whether the timestamp extraction is done correctly. When trying the oci-image-verification on an internally signed image (with TSA), I'm getting an error going back to ASN.1 parsing error (see my question on Slack):

$ oci-image-verification -onlineTlog=false -requireTlog=false -requireTimestamp=true -expectedIssuerRegex='.*' -trustedrootJSONpath=$HOME/dev/files/trustedroot.json -expectedSAN='spiffe://cd.internal.project/xyz/12345' -ociImage docker.acompany.com:4443/name/el8/abc:8.10
failed to verify timestamps: threshold not met for verified signed & log entry integrated timestamps: 0 < 1

as mentioned in the Slack message, the "underlying" error is (???)

ASN.1 parsing error  from [github.com/digitorus/timestamp.ParseResponse](http://github.com/digitorus/timestamp.ParseResponse) (called from [github.com/sigstore/timestamp-authority/pkg/verification.VerifyTimestampResponse](http://github.com/sigstore/timestamp-authority/pkg/verification.VerifyTimestampResponse)):
error parsing response into Timestamp: asn1: structure error: tags don't match (16 vs {class:1 tag:13 length:73 isCompound:false}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} response @2

Release Note

NONE

Documentation

n/a

@dmitris dmitris force-pushed the upd-examples branch 5 times, most recently from 714ddaa to b394b76 Compare October 23, 2024 12:15
@dmitris
Copy link
Contributor Author

dmitris commented Oct 24, 2024

was able to verify an OCI image using trustedroot.json, the command was similar to this one, therefore changing from Draft to "Ready to review":

$ oci-image-verification -ociImage docker.internal.com:4443/name/xyz:1.0 -onlineTlog=false -requireTlog=false -ignore-sct=true -requireTimestamp=true -expectedIssuerRegex='.*' -expectedSAN='spiffe://cd.cisystem.project/cd/build12345' -trustedrootJSONpath=trustedroot.json
Verification successful!
{
   "mediaType": "application/vnd.dev.sigstore.verificationresult+json;version=0.1",
   "signature": {
      "certificate": {
         "certificateIssuer": "CN=[common name]",
         "subjectAlternativeName": "spiffe://cd.cisystem.project/cd/build12345"
      }
   },
   "verifiedTimestamps": [
      {
         "type": "TimestampAuthority",
         "uri": "",
         "timestamp": "2024-10-10T01:28:22Z"
      }
   ],
   "verifiedIdentity": {
      "subjectAlternativeName": {
         "subjectAlternativeName": "spiffe://cd.cisystem.project/cd/build12345"
      },
      "issuer": {
         "issuer": "",
         "regexp": ".*"
      }
   }
}

@dmitris dmitris marked this pull request as ready for review October 24, 2024 16:04
@dmitris dmitris requested a review from a team as a code owner October 24, 2024 16:04
Copy link
Member

@kommendorkapten kommendorkapten left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

@kommendorkapten kommendorkapten merged commit 74cb6b5 into sigstore:main Nov 5, 2024
10 checks passed
@dmitris dmitris deleted the upd-examples branch November 5, 2024 13:20
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.

2 participants