File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,14 @@ pub async fn validate_signatures(
282282 return Ok ( false ) ;
283283 } ;
284284
285+ if doc. signatures ( ) . is_empty ( ) {
286+ doc. report ( ) . other (
287+ "Catalyst Signed Document is unsigned" ,
288+ "During Catalyst Signed Document signature validation" ,
289+ ) ;
290+ return Ok ( false ) ;
291+ }
292+
285293 let sign_rules = doc
286294 . signatures ( )
287295 . cose_signatures_with_kids ( )
Original file line number Diff line number Diff line change @@ -23,14 +23,20 @@ async fn single_signature_validation_test() {
2323 provider. add_pk ( kid. clone ( ) , pk) ;
2424 assert ! ( validator:: validate_signatures( & signed_doc, & provider)
2525 . await
26- . is_ok_and ( |v| v ) ) ;
26+ . unwrap ( ) ) ;
2727
2828 // case: empty provider
2929 assert ! (
30- validator:: validate_signatures( & signed_doc, & TestVerifyingKeyProvider :: default ( ) )
30+ ! validator:: validate_signatures( & signed_doc, & TestVerifyingKeyProvider :: default ( ) )
3131 . await
32- . is_ok_and ( |v| !v )
32+ . unwrap ( )
3333 ) ;
34+
35+ // case: missing signatures
36+ let ( unsigned_doc, ..) = common:: create_dummy_doc ( UuidV4 :: new ( ) . into ( ) ) . unwrap ( ) ;
37+ assert ! ( !validator:: validate_signatures( & unsigned_doc, & provider)
38+ . await
39+ . unwrap( ) ) ;
3440}
3541
3642#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments