8000 Fix gitsign for public Sigstore changes. by wlynch · Pull Request #50 · sigstore/gitsign · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix gitsign for public Sigstore changes. #50

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

Merged
merged 2 commits into from
Jun 2, 2022
Merged

Conversation

wlynch
Copy link
Member
@wlynch wlynch commented Jun 1, 2022

Summary

There were a few updates to public sigstore today, that ended up
breaking gitsign.

  1. Fulcio now uses an intermediary cert. TIL that DER encoding will sort
    values for stability, which means that the ordering of these certs
    can change. This PR fixes gitsign for the public instance, but is not
    a complete solution. We'll need to follow up with another change to
    be smarter about how we ID the certificate to use.
  2. Rekor now uses a sharded entry ID, which breaks how we were looking
    up Rekor entries since the sharded entry ID didn't match the
    underlying UUID (even though it did). Added normalization to work for
    either case.

Also updates rekor/cosign deps, we need rekor >= 0.5
(https://blog.sigstore.dev/sigstore-project-update-march-2022-bf34aa632388)

Signed-off-by: Billy Lynch billy@chainguard.dev

Ticket Link

Fixes #49

Release Note

Fixes gitsign for use with public Sigstore instance as of June 1, 2022

There were a few updates to public sigstore today, that ended up
breaking gitsign.

1. Fulcio now uses an intermediary cert. TIL that DER encoding will sort
   values for stability, which means that the ordering of these certs
   can change. This PR fixes gitsign for the public instance, but is not
   a complete solution. We'll need to follow up with another change to
   be smarter about how we ID the certificate to use.
2. Rekor now uses a sharded entry ID, which breaks how we were looking
   up Rekor entries since the sharded entry ID didn't match the
   underlying UUID (even though it did). Added normalization to work for
   either case.

Also updates rekor/cosign deps, we need rekor >= 0.5
(https://blog.sigstore.dev/sigstore-project-update-march-2022-bf34aa632388)

Signed-off-by: Billy Lynch <billy@chainguard.dev>
@wlynch wlynch requested review from imjasonh and nsmith5 June 1, 2022 21:36
imjasonh
imjasonh previously approved these changes Jun 1, 2022
@wlynch
Copy link
Member Author
wlynch commented Jun 1, 2022

The test status is lying - this is still failing https://github.com/sigstore/gitsign/runs/6698779041?check_suite_focus=true#step:4:233

(which probably means it's sorting by something non-deterministic like key ID 😭 )

@wlynch wlynch marked this pull request as draft June 1, 2022 22:23
Turns out cert ordering was still non-deterministic, so restricting the
certs included to just the leaf cert (which is probably okay in most
cases?)

We might add support back for this later, but for now this should be
okay.

Also fix e2e test so failing validation actually causes a non-zero exit
code.

Signed-off-by: Billy Lynch <billy@chainguard.dev>
@wlynch wlynch marked this pull request as ready for review June 1, 2022 22:50
@wlynch wlynch marked this pull request as draft June 1, 2022 22:55
@wlynch wlynch marked this pull request as ready for review June 1, 2022 23:12
@wlynch
Copy link
Member Author
wlynch commented Jun 1, 2022

e2e test is pulling code from main, not head (since pull_request_target is considered trusted by default).

Latest commit is signed with its own tool if you want to verify though: https://gist.github.com/wlynch/9c9e86858af0873cca77079699dff7b9

@haydentherapper
Copy link
Contributor

FYI, we had to rollback to Rekor 0.5 before the sharding work - This will work with 0.5 and 0.7, correct?

@wlynch
Copy link
Member Author
wlynch commented Jun 1, 2022

FYI, we had to rollback to Rekor 0.5 before the sharding work - This will work with 0.5 and 0.7, correct?

It should work for either. I didn't have a strong preference so I just bumped to the latest version. Seems to work fine, but if there are any sharp edges to be weary of let me know!

KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
Roots: fulcioroots.Get(),
Intermediates: fulcioroots.GetIntermediates(),
KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be changed to ExtKeyUsageCodeSigning to more narrowly scope the verification?

Copy link
Member Author

Choose a re 8000 ason for hiding this comment

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

Yup we actually do this else where -

KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageCodeSigning},

I'll look into refactoring this in another PR (mainly so we don't lose the 50/50 on whether the e2e test will pick the right cert to validate)

Copy link
Member Author

Choose a reason for hiding this comment

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

#52 to track

@wlynch wlynch merged commit 2d9cff2 into sigstore:main Jun 2, 2022
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.

Gitsign fails to validate commits after public instance migration
4 participants
0