8000 sigstore: add a CT keyring, use it for SCT verification by woodruffw · Pull Request #267 · sigstore/sigstore-python · GitHub
[go: up one dir, main page]

Skip to content

sigstore: add a CT keyring, use it for SCT verification #267

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 11 commits into from
Oct 24, 2022

Conversation

woodruffw
Copy link
Member
@woodruffw woodruffw commented Oct 20, 2022

WIP; just to get something up.

Some TODOs:

  • The --ctfe flag behavior needs to be updated to work with the new CTKeyring API
  • Unit testing

Closes #263.

Closes #260.

Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw added component:signing Core signing functionality component:verification Core verification functionality labels Oct 20, 2022
@woodruffw woodruffw self-assigned this Oct 20, 2022
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw requested a review from di October 20, 2022 22:52
Signed-off-by: William Woodruff <william@trailofbits.com>
pass


class CTKeyring:
Copy link
Member Author

Choose a reason for hiding this comment

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

Flagging for review: I welcome a better name for this class (and its corresponding exception class) 🙂

@woodruffw woodruffw marked this pull request as ready for review October 20, 2022 23:00
@woodruffw
Copy link
Member Author

This is good for an initial review. Key changes:

  • We no longer assume that there's only one CTFE signing key during SCT verification. Instead, we have a CTKeyring that contains one or more signing keys, mapped by their key ID (per RFC 6962), and each SCT is verified against the signing key that it identifies.
  • The sigstore._utils module contains a handful of cross-module helpers that I broke out as part of these changes, particularly around having a checked union type for the kinds of keys we support (RSA and EC).

Signed-off-by: William Woodruff <william@trailofbits.com>
di
di previously approved these changes Oct 21, 2022
Copy link
Member
@di di left a comment

Choose a reason for hiding this comment

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

LGTM with or without the nits.

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.

LGTM, just some nits and a comment for unrelated changes

)
else:
# Unreachable.
raise CTKeyringError("unreachable")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Error could be "unsupported key type" to be more descriptive


def __del__(self) -> None:
self.session.close()

@classmethod
def production(cls) -> RekorClient:
return cls(
DEFAULT_REKOR_URL, _DEFAULT_REKOR_ROOT_PUBKEY, _DEFAULT_REKOR_CTFE_PUBKEY
DEFAULT_REKOR_URL, _DEFAULT_REKOR_ROOT_PUBKEY, CTKeyring.production()
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, this would require larger changes than should be in this PR, but is there a separate client for CT? The CT log and Rekor are separate logs. The CT log is accessed at ctfe.sigstore.dev/, and while all Sigstore clients don't need to do online verification (since they only verify the SCTs offline), it's separate from rekor. I'd recommend splitting these apart, or at least associated CT with Fulcio rather than Rekor

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, @asraa brought this up as feedback here: #263 (comment)

I agree that this should be broken out, and I'll do that in a follow-up 🙂

@woodruffw woodruffw dismissed stale reviews from haydentherapper and di via 7d56849 October 21, 2022 20:49
@woodruffw woodruffw enabled auto-merge (squash) October 22, 2022 14:14
@woodruffw woodruffw merged commit b5dd9ee into main Oct 24, 2022
@woodruffw woodruffw deleted the ww/ct-signing-refactor branch October 24, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:signing Core signing functionality component:verification Core verification functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor SCT verification/CT key handling [CI] Integration failure: staging instance
3 participants
0