File tree Expand file tree Collapse file tree
pkg/platform/runtime/validate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ func Attestation(attestationFile string) error {
4747 // Verify signing certificate.
4848 pemBlock , _ := pem .Decode ([]byte (att .Signatures [0 ].Cert ))
4949 if pemBlock == nil {
50- return errs . Wrap ( err , "Unable to decode attestation certificate" )
50+ return locale . NewError ( "validate_attestation_fail_decode_cert" , "Unable to decode attestation certificate" )
5151 }
5252
5353 cert , err := x509 .ParseCertificate (pemBlock .Bytes )
@@ -95,8 +95,6 @@ func Attestation(attestationFile string) error {
9595 return errs .Wrap (err , "Unable to validate signature" )
9696 }
9797
98- // TODO: read payload artifact SHAs and validate them against downloaded artifact SHAs.
99-
10098 return nil
10199}
102100
Original file line number Diff line number Diff line change @@ -12,4 +12,12 @@ func TestValidate(t *testing.T) {
1212 attestationFile := filepath .Join (osutil .GetTestDataDir (), "bzip2_attestation.json" )
1313 err := Attestation (attestationFile )
1414 assert .NoError (t , err )
15+
16+ attestationFile = filepath .Join (osutil .GetTestDataDir (), "bzip2_attestation_bad_cert.json" )
17+ err = Attestation (attestationFile )
18+ assert .Error (t , err )
19+
20+ attestationFile = filepath .Join (osutil .GetTestDataDir (), "bzip2_attestation_bad_sig.json" )
21+ err = Attestation (attestationFile )
22+ assert .Error (t , err )
1523}
You can’t perform that action at this time.
0 commit comments