@@ -58,23 +58,27 @@ func TestCertificateIdentityVerify(t *testing.T) {
5858 }
5959
6060 // First, let's test happy paths:
61- issuerOnlyID , _ := certIDForTesting ("" , "" , ActionsIssuerValue , "" , "" )
62- assert .NoError (t , issuerOnlyID .Verify (actualCert ))
61+ values , _ := certIDForTesting (SigstoreSanValue , "" , ActionsIssuerValue , "" , "" )
62+ assert .NoError (t , values .Verify (actualCert ))
6363
64- issuerOnlyRegex , _ := certIDForTesting ("" , "" , "" , ActionsIssuerRegex , "" )
65- assert .NoError (t , issuerOnlyRegex .Verify (actualCert ))
66-
67- sanValueOnly , _ := certIDForTesting (SigstoreSanValue , "" , "" , "" , "" )
68- assert .NoError (t , sanValueOnly .Verify (actualCert ))
69-
70- sanRegexOnly , _ := certIDForTesting ("" , SigstoreSanRegex , "" , "" , "" )
71- assert .NoError (t , sanRegexOnly .Verify (actualCert ))
64+ regexMatches , _ := certIDForTesting ("" , SigstoreSanRegex , "" , ActionsIssuerRegex , "" )
65+ assert .NoError (t , regexMatches .Verify (actualCert ))
7266
7367 // multiple values can be specified
7468 sanRegexAndIssuer , _ := certIDForTesting ("" , SigstoreSanRegex , ActionsIssuerValue , "" , "github-hosted" )
7569 assert .NoError (t , sanRegexAndIssuer .Verify (actualCert ))
7670
7771 // unhappy paths:
72+ // ensure we error when underspecified
73+ empty , _ := certIDForTesting ("" , "" , "" , "" , "" )
74+ assert .Error (t , empty .Verify (actualCert ))
75+
76+ justSan , _ := certIDForTesting (SigstoreSanValue , "" , "" , "" , "" )
77+ assert .Error (t , justSan .Verify (actualCert ))
78+
79+ justIssuerRegex , _ := certIDForTesting ("" , "" , "" , ActionsIssuerRegex , "" )
80+ assert .Error (t , justIssuerRegex .Verify (actualCert ))
81+
7882 // wrong issuer
7983 sanRegexAndWrongIssuer , _ := certIDForTesting ("" , SigstoreSanRegex , "https://token.actions.example.com" , "" , "" )
8084 errValueMismatch := & ErrValueMismatch {}
0 commit comments