-
Notifications
You must be signed in to change notification settings - Fork 59
Sign and verify with rekorv2 #1432
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
base: main
Are you sure you want to change the base?
Conversation
334e1b2
to
983bfa6
Compare
|
last commit: Made sure we support the same signature algorithms in verification that we support with rekor v1 entries (we should support a bit more but that's another PR) |
If signingconfig contains rekor v2, let's start preferring it Make sure we test the status quo (no rekor v2 in signing config) and the case where there is a rekor v2 in signing config. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This is current staging trust root and signing config, with just the rekor v2 instance added to signing config $ TRUSTCONFIG=test/assets/trust_config/staging-but-sign-with-rekor-v2.json $ sigstore --trust-config $TRUSTCONFIG sign README.md Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This code is originally from Ramon, updated by Jussi $ TRUSTCONFIG=test/assets/trust_config/staging-but-sign-with-rekor-v2.json $ sigstore --trust-config $TRUSTCONFIG sign README.md $ sigstore --staging verify identity \ --cert-identity jku@goto.fi \ --cert-oidc-issuer https://github.com/login/oauth README.md OK: README.md Co-authored-by: Ramon Petgrave <ramon.petgrave64@gmail.com> Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This makes the code quite a bit uglier: we will likely want to refactor... Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
These are fairly basic for now. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
This reverts commit d7ddd50. Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
We can handle not just the key extraction but getting the whole v2.Verifier for the certificate: both v002 types need it. Also make private methods private and improve docstrings Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This change affects the signing certificate verification in rekor v2 entries: * Support all ECDSA keys listed in https://github.com/sigstore/architecture-docs/blob/main/algorithm-registry.md * Don't support other algorithms yet since the actual signature verification does not support them currently Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Rebased on main after #1422 was merged: I will do a final self-review and mark this ready for review EDIT looks fine to me. The beginnings of conformance tests are in sigstore/sigstore-conformance#216 -- that PR is pending a sigstore-python release (or at least merging of this PR) |
Also, a future work item is concurrent rekor requests:
(alternative to parallelizing is to talk rekor-tiles project into providing api for creating multiple entries... But that'll still require client changes) |
I think we can get a lot more coverage without writing new tests in #1441 |
@pytest.fixture | ||
def staging_with_rekorv2() -> tuple[ | ||
type[SigningContext], type[Verifier], IdentityToken | ||
]: |
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.
In #1441, we could add another param specific for this "alpha" instance.
public_key = certificate.public_key() | ||
|
||
if isinstance(public_key, ec.EllipticCurvePublicKey): | ||
if isinstance(public_key.curve, ec.SECP256R1): |
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.
To confirm, what set of algorithms was supported previously?
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.
It's that same one, also hardcoded in a few other places in sigstore-python.
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.
#1439 is the follow up
I believe verify/verifier.py
is really the only relevant place where this is hard coded (documented a couple of lines above this): the usage in sign.py
is a separate decision that shouldn't be tied to this.
Start signing and verifying with rekor v2 (when signingconfig / trustedroot instruct to do so).
This is a continuation of #1414 (although does not use any direct commits from there). The verifier.py changes are mostly from @ramonpetgrave64
Contents:
verify_dsse()
andverify_artifact()
now handle v002 entry types_validate_*_v001_entry_body()
methods are just the existing code path refactored to separate methods_validate_*_v002_entry_body()
methods are the new validation code--trust-config staging-but-sign-with-rekor-v2.json
Notes:
--experimental
flag for a release if this seems useful -- but I think I would prefer no new flags