Skip to content

Commit cf3c0c3

Browse files
committed
Explicitly deny signatures containing ds:Object elements (E91)
1 parent 6179809 commit cf3c0c3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/XML/SignedElementTrait.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use SimpleSAML\Assert\Assert;
88
use SimpleSAML\SAML2\Compat\ContainerSingleton;
9+
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
910
use SimpleSAML\XMLSecurity\Exception\ReferenceValidationFailedException;
1011
use SimpleSAML\XMLSecurity\XML\ds\Signature;
1112
use SimpleSAML\XMLSecurity\XML\SignedElementTrait as BaseSignedElementTrait;
@@ -46,6 +47,18 @@ protected function setSignature(Signature $signature): void
4647
ReferenceValidationFailedException::class,
4748
);
4849

50+
/**
51+
* E91: Disallow <ds:Object> element in signatures
52+
*
53+
* The <ds:Object> element is not defined for use with SAML signatures, and SHOULD NOT be present.
54+
*/
55+
56+
Assert::isEmpty(
57+
$signature->getObjects(),
58+
ProtocolViolationException::class,
59+
'The <ds:Object> element is not defined for use with SAML signatures, and SHOULD NOT be present.',
60+
);
61+
4962
$this->signature = $signature;
5063
}
5164

0 commit comments

Comments
 (0)