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(
282
282
return Ok ( false ) ;
283
283
} ;
284
284
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
+
285
293
let sign_rules = doc
286
294
. signatures ( )
287
295
. cose_signatures_with_kids ( )
Original file line number Diff line number Diff line change @@ -23,14 +23,20 @@ async fn single_signature_validation_test() {
23
23
provider. add_pk ( kid. clone ( ) , pk) ;
24
24
assert ! ( validator:: validate_signatures( & signed_doc, & provider)
25
25
. await
26
- . is_ok_and ( |v| v ) ) ;
26
+ . unwrap ( ) ) ;
27
27
28
28
// case: empty provider
29
29
assert ! (
30
- validator:: validate_signatures( & signed_doc, & TestVerifyingKeyProvider :: default ( ) )
30
+ ! validator:: validate_signatures( & signed_doc, & TestVerifyingKeyProvider :: default ( ) )
31
31
. await
32
- . is_ok_and ( |v| !v )
32
+ . unwrap ( )
33
33
) ;
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( ) ) ;
34
40
}
35
41
36
42
#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments