-
Notifications
You must be signed in to change notification settings - Fork 546
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
Consolidate certificate expiry logic #2504
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2504 +/- ##
==========================================
- Coverage 30.16% 30.14% -0.02%
==========================================
Files 139 139
Lines 8583 8595 +12
==========================================
+ Hits 2589 2591 +2
- Misses 5621 5629 +8
- Partials 373 375 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for splitting this up! This looks great.
229b5b2
to
c9af038
Compare
@cpanato Any idea about why the windows test is failing? Not sure how best to debug this. |
1bd5cda
to
23cf1cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awaiting the rebase, but lgtm! don't block on that comment, since it's fairly minor
Should not change behavior now, but this should make it easier to move code around. Signed-off-by: Miloslav Trmač <[email protected]>
Let's decrease the risk of a caller not noticing an error, and make it a bit shorter to read and more clear that they are all, in fact, error paths. This may change the return value in some cases. Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
This will allow us to move the certificate expiry responsibility to the caller. Should not change behavior, assuming timestamp.ParseResponse can't fail for an alraedy verified response. Signed-off-by: Miloslav Trmač <[email protected]>
... from VerifyRFC3161Timestamp, which has no reason to care, to verifyInternal. Should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
Don't repeat the conditions, and make the flow a bit clearer. Should not change behavior, unless there are multiple reasons to reject the signature. Signed-off-by: Miloslav Trmač <[email protected]>
We will use them to decouple the bundle handling from certificate expiry verification. Should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior, just to prepare a further move Signed-off-by: Miloslav Trmač <[email protected]>
Another small step. Should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
Now, we always validate certificate expiration against _some_ time. Even if we don't interact with Rekor bundles at all, we validate it against the current time. Signed-off-by: Miloslav Trmač <[email protected]>
Consolidate all the expiry checks into one place. Should not change behavior, unless there are multiple reasons to reject the signature. Signed-off-by: Miloslav Trmač <[email protected]>
Do them before looking at the certificate at all; we need to do this first to obtain signature creation times. This may affect user-visible error messages; adjust a test. Signed-off-by: Miloslav Trmač <[email protected]>
Signed-off-by: Hayden B <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
7349b6c
to
844de7c
Compare
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Signed-off-by: Hayden Blauzvern <[email protected]>
Summary
This is a subset of #2482 as requested in #2482 (comment) (a bit larger than that):
verifyInternal
now has one place (although not yet the correct place) to do certificate expiry checks, instead of that happening inVerifyRFC3161Timestamp
See #2482 for previous discussion, and the general rationale of only using data after it is verified (which is not what this PR really does, but it’s a prerequisite).
Release Note
cosign verify-blob --cert-chain … --certificate … --skip-tlog-verify
now requires the leaf certificate to not be expired.Documentation