Skip to content

Commit

Permalink
Use the trust root and bundle contents to construct verification poli…
Browse files Browse the repository at this point in the history
…cy (#42)

`test_verify_rejects_bad_tsa_timestamp`, which was added in
sigstore/sigstore-conformance#112, expects us reject bundles that have a bad TSA timestamp when the trust root has TSA information in it.

---------

Signed-off-by: Zach Steindler <[email protected]>
  • Loading branch information
steiza authored Dec 14, 2023
1 parent fcb55a2 commit 0946840
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cmd/conformance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,31 @@ func main() {
// Load trust root
tr := getTrustedRoot()

// Verify bundle
sev, err := verify.NewSignedEntityVerifier(tr, verify.WithTransparencyLog(1), verify.WithSignedCertificateTimestamps(1))
verifierConfig := []verify.VerifierOption{}
verifierConfig = append(verifierConfig, verify.WithSignedCertificateTimestamps(1))

// Check bundle and trusted root for signed timestamp information
bundleTimestamps, err := b.Timestamps()
if err != nil {
fmt.Println(err)
os.Exit(1)
}

if len(tr.TSACertificateAuthorities()) > 0 && len(bundleTimestamps) > 0 {
verifierConfig = append(verifierConfig, verify.WithSignedTimestamps(1))
}

// Check bundle and trusted root for Tlog information
if len(tr.TlogAuthorities()) > 0 && b.HasInclusionPromise() {
verifierConfig = append(verifierConfig, verify.WithTransparencyLog(1))
}

sev, err := verify.NewSignedEntityVerifier(tr, verifierConfig...)
if err != nil {
log.Fatal(err)
}

// Verify bundle
_, err = sev.Verify(b, verify.NewPolicy(verify.WithArtifact(file), identityPolicies...))
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 0946840

Please sign in to comment.