Skip to content

Chore: Refactor how we handle verification materials #250

Closed

Description

@woodruffw

Conceptually, there are three mandatory pieces of sigstore verification material, and one optional piece:

  • The artifact's SHA256 hash (naive datatype: str)
  • The artifact's signature (naive datatype: bytes, or str if base64-encoded)
  • The artifact's PEM-formatted signing certificate (naive datatype: str)
  • (Optionally) the offline Rekor entry (JSON, deserialized to RekorBundle or RekorEntry in Offline Rekor bundle generation and verification #247)

Right now, the verify API takes these as independent parameters, along with some other options (which will grow over time, as we support different configurations and verification policies):

    def verify(
        self,
        input_: bytes,
        certificate: bytes,
        signature: bytes,
        expected_cert_email: Optional[str] = None,
        expected_cert_oidc_issuer: Optional[str] = None,
        offline_rekor_entry: Optional[RekorEntry] = None,
    ) -> VerificationResult:

This is going to become unwieldly, so we should probably rethink the top-level API here.

Related:

Activity

  1. added
    enhancement
    refactoring
    component:api
    on Oct 13, 2022
  2. woodruffw commented on Oct 13, 2022

    @woodruffw
    MemberAuthor

    One thought: a top-level verify API like this might be nice:

    def verify(bundle: VerificationBundle, options: VerificationOptions) -> VerificationResult

    ...where VerificationBundle could be constructed from a Sigstore bundle, from individual inputs, etc., and VerificationOptions could contain settings for the expected OIDC issuer, etc.

  3. woodruffw commented on Oct 14, 2022

    @woodruffw
    MemberAuthor

    More thinking out loud: VerificationBundle should be correct by construction, meaning that it should be impossible to create a VerificationBundle that includes an offline RekorEntry without checking that entry's relevancy to the rest of the verification materials.

  4. woodruffw commented on Nov 3, 2022

    @woodruffw
    MemberAuthor

    Temporarily blocked on #289 and #288, since we want this functionality in before a more general refactor.

  5. mayaCostantini commented on Nov 7, 2022

    @mayaCostantini
    Contributor

    Was a verification bundle schema already discussed somewhere? I would be interested in taking up this issue if it has no assignee yet.

  6. di commented on Nov 7, 2022

    @di
    Member
  7. woodruffw commented on Nov 7, 2022

    @woodruffw
    MemberAuthor

    Additionally, the protobuf definition for the bundle is being developed here: https://github.com/sigstore/protobuf-specs

  8. woodruffw commented on Nov 7, 2022

    @woodruffw
    MemberAuthor

    I'm currently working on this refactor in ww/verify-api-refactor, although those changes won't include the bundle itself -- it'll only concern cleaning up the API surface and making it easier to consume bundles.

  9. mayaCostantini commented on Nov 7, 2022

    @mayaCostantini
    Contributor

    @di @woodruffw Thank you for the info, I will look into it soon 👍

  10. woodruffw commented on Nov 14, 2022

    @woodruffw
    MemberAuthor

    Working on this in #299.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:apienhancementrefactoring

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions