Skip to content
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

feat: add offline bundle signature verification #457

Merged
merged 6 commits into from
Feb 3, 2023

Conversation

asraa
Copy link
Contributor

@asraa asraa commented Jan 27, 2023

Signed-off-by: Asra Ali asraa@google.com

  • Adds cryptographic bundle verification following the Sigstore client spec. I expect this will be replaced by a direct call to another library in the long term
  • Removed a test case that was no longer relevant. That test was checking our code against the Rekor server update that returned a new return response. Now all code tests the new server response anyway.
  • Pipes out trusted root info outside the verification calls
  • Updates cosign to v2

Signed-off-by: Asra Ali <asraa@google.com>
@asraa asraa changed the title feat: add bundle signature verification [DRAFT] feat: add bundle signature verification Jan 27, 2023
Copy link
Contributor

@laurentsimon laurentsimon left a comment

Choose a reason for hiding this comment

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

Looks great!

verifiers/internal/gha/bundle.go Outdated Show resolved Hide resolved
verifiers/internal/gha/bundle.go Outdated Show resolved Hide resolved
verifiers/internal/gha/bundle.go Show resolved Hide resolved
}{
{
name: "valid",
path: "./testdata/bundle/attestation.intoto.sigstore",
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll add invalid / adversarial ones inn the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added one or two that were easily to manipulate without creating a test Rekor signer. Filed a follow-up issue
#461

We'll be generating a suite from sigstore-go pretty soon, so we can close this out either by borrowing cases there or moving the code to call a verification func there that's tested.

@@ -67,13 +67,17 @@ func verifyTlogEntryByUUID(ctx context.Context, rekorClient *client.Rekor, entry
return nil, errors.New("expected matching UUID")
}
// Validate the entry response.
return verifyTlogEntry(ctx, rekorClient, entry)
return verifyTlogEntry(ctx, entry, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

iiuc, we'll perform an online verification by default to be consistent with our existing code. And we'll provide an option to turn it off in the futuer, e.g. rekor-log-offline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now the existing code still validates the inclusion proof (which requires online).

I haven't configured augmenting the offline verification with an online proof yet, this code just checks verification of the offline material. I'll file an issue though to augment with an option to check inclusion online as well.

@laurentsimon
Copy link
Contributor

laurentsimon commented Jan 27, 2023

qq: does the verification also verifies the SCT (ie the fulcio CA cert was recorded in the TLS CT log)?
Are the leaf cert also appended to the PKI CT logs? Or only CA certs are?

somewhat related: something we need to do is unable this for the TLS connection as well #458

Signed-off-by: Asra Ali <asraa@google.com>
@asraa
Copy link
Contributor Author

asraa commented Feb 1, 2023

qq: does the verification also verifies the SCT (ie the fulcio CA cert was recorded in the TLS CT log)?

Yes! By default now the check is on

Are the leaf cert also appended to the PKI CT logs? Or only CA certs are?

Hmm not sure I totally understand this. The leaf cert is in the CT log.

@asraa asraa changed the title [DRAFT] feat: add bundle signature verification feat: add offline bundle signature verification Feb 1, 2023
Signed-off-by: Asra Ali <asraa@google.com>
@laurentsimon
Copy link
Contributor

laurentsimon commented Feb 1, 2023

qq: does the verification also verifies the SCT (ie the fulcio CA cert was recorded in the TLS CT log)?

Yes! By default now the check is on

+1

Are the leaf cert also appended to the PKI CT logs? Or only CA certs are?

Hmm not sure I totally understand this. The leaf cert is in the CT log.

Are CA certs (ie Fulcio cert) in CT log as well? Do we care?

How about rekor cert (which is a leaf cert)? Do we care?

Which are verified?

@asraa
Copy link
Contributor Author

asraa commented Feb 1, 2023

Are CA certs (ie Fulcio cert) in CT log as well? Do we care?

Oh, yes the CA cert is in the CT log. SCT verification being enforced now (regenerating test cases, this is why they are failing) checks the offline promise of that. We don't check them online, but neither does normal CT. So this part is now enforced/verified.

How about rekor cert (which is a leaf cert)? Do we care?

This I do not understand. Rekor signs with a public key that is retrieved from the TUF root and does not have a leaf cert.

@laurentsimon
Copy link
Contributor

Are CA certs (ie Fulcio cert) in CT log as well? Do we care?

Oh, yes the CA cert is in the CT log. SCT verification being enforced now (regenerating test cases, this is why they are failing) checks the offline promise of that. We don't check them online, but neither does normal CT. So this part is now enforced/verified.

How about rekor cert (which is a leaf cert)? Do we care?

This I do not understand. Rekor signs with a public key that is retrieved from the TUF root and does not have a leaf cert.

OK. I thought maybe there was a cert issued as well. Ignore my comment then.

Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
@@ -17,6 +17,9 @@ var (
trustedBuilderRepository = "slsa-framework/slsa-github-generator"
e2eTestRepository = "slsa-framework/example-package"
certOidcIssuer = "https://token.actions.githubusercontent.com"
// This is used in cosign's CheckOpts for validating the certificate. We
// do specific builder verification after this.
certSubjectRegexp = "https://github.com/*"
Copy link
Contributor

Choose a reason for hiding this comment

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

that will also be necessary for npm provenance verification (the one without the trusted builder)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we intend on verifying non-L3 provenance though?

but yes - it's just a nit that cosign v2 requires some validation on it so I had to add it even though we do a more detail check on it later.

@laurentsimon
Copy link
Contributor

LGTM to merge.

@asraa asraa merged commit 362bd1a into slsa-framework:main Feb 3, 2023
ramonpetgrave64 pushed a commit to ramonpetgrave64/slsa-verifier that referenced this pull request Apr 18, 2024
Co-authored-by: Ian Lewis <ianlewis@google.com>
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.

None yet

2 participants