@@ -532,7 +532,7 @@ class VerifyAttributeNameFormat(Check):
532
532
cid = "verify-attribute-name-format"
533
533
534
534
def _func (self , conv ):
535
- if "name_format" not in conv .idp_constraints :
535
+ if "name_format" not in conv .msg_constraints :
536
536
return {}
537
537
538
538
# Should be a AuthnResponse or Response instance
@@ -546,15 +546,22 @@ def _func(self, conv):
546
546
atrstat = assertion .attribute_statement [0 ]
547
547
for attr in atrstat .attribute :
548
548
try :
549
- assert attr .name_format == conv .idp_constraints [
549
+ assert attr .name_format == conv .msg_constraints [
550
550
"name_format" ]
551
+ logger .debug ("Attribute name format valid: " +
552
+ attr .name_format )
551
553
except AssertionError :
552
- if NAME_FORMAT_UNSPECIFIED != conv .idp_constraints [
554
+ if NAME_FORMAT_UNSPECIFIED != conv .msg_constraints [
553
555
"name_format" ]:
554
556
self ._message = \
555
- "Wrong name format: '%s'" % attr .name_format
557
+ "Wrong name format: '%s', should be %s" % \
558
+ (attr .name_format , \
559
+ conv .msg_constraints ["name_format" ])
556
560
self ._status = CRITICAL
557
561
break
562
+ else :
563
+ logger .debug ("Accepting any attribute name format" )
564
+
558
565
return {}
559
566
560
567
@@ -574,17 +581,17 @@ def _digest_algo(self, signature, allowed):
574
581
return True
575
582
576
583
def _func (self , conv ):
577
- if "digest_algorithm" not in conv .idp_constraints :
584
+ if "digest_algorithm" not in conv .msg_constraints :
578
585
logger .info ("Not verifying digest_algorithm (not configured)" )
579
586
return {}
580
587
else :
581
588
try :
582
- assert len (conv .idp_constraints ["digest_algorithm" ]) > 0
589
+ assert len (conv .msg_constraints ["digest_algorithm" ]) > 0
583
590
except AssertionError :
584
591
self ._message = "List of allowed digest algorithm must not be empty"
585
592
self ._status = CRITICAL
586
593
return {}
587
- _algs = conv .idp_constraints ["digest_algorithm" ]
594
+ _algs = conv .msg_constraints ["digest_algorithm" ]
588
595
589
596
response = conv .saml_response [- 1 ].response
590
597
@@ -616,17 +623,17 @@ def _sig_algo(self, signature, allowed):
616
623
return True
617
624
618
625
def _func (self , conv ):
619
- if "signature_algorithm" not in conv .idp_constraints :
626
+ if "signature_algorithm" not in conv .msg_constraints :
620
627
logger .info ("Not verifying signature_algorithm (not configured)" )
621
628
return {}
622
629
else :
623
630
try :
624
- assert len (conv .idp_constraints ["signature_algorithm" ]) > 0
631
+ assert len (conv .msg_constraints ["signature_algorithm" ]) > 0
625
632
except AssertionError :
626
633
self ._message = "List of allowed signature algorithm must not be empty"
627
634
self ._status = CRITICAL
628
635
return {}
629
- _algs = conv .idp_constraints ["signature_algorithm" ]
636
+ _algs = conv .msg_constraints ["signature_algorithm" ]
630
637
631
638
response = conv .saml_response [- 1 ].response
632
639
@@ -648,19 +655,19 @@ class VerifySignedPart(Check):
648
655
649
656
def _func (self , conv ):
650
657
651
- if "signed_part" not in conv .idp_constraints :
658
+ if "signed_part" not in conv .msg_constraints :
652
659
return {}
653
660
654
661
response = conv .saml_response [- 1 ].response
655
- if "response" in conv .idp_constraints ["signed_part" ]:
662
+ if "response" in conv .msg_constraints ["signed_part" ]:
656
663
if response .signature :
657
664
pass
658
665
else :
659
666
self ._message = "Response not signed"
660
667
self ._status = CRITICAL
661
668
662
669
if self ._status == OK :
663
- if "assertion" in conv .idp_constraints ["signed_part" ]:
670
+ if "assertion" in conv .msg_constraints ["signed_part" ]:
664
671
for assertion in response .assertion :
665
672
if assertion .signature :
666
673
pass
0 commit comments