Skip to content

Commit 6a88a07

Browse files
committed
Ensure message is of type AttributeQuery
1 parent 7bca441 commit 6a88a07

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"php": "^8.1",
3838

3939
"nyholm/psr7": "~1.8.2",
40+
"simplesamlphp/assert": "~1.9.0",
4041
"simplesamlphp/saml2": "~5.0.3",
4142
"simplesamlphp/simplesamlphp": "~2.4.0",
4243
"simplesamlphp/xml-common": "~1.25.0",

src/Controller/AttributeServer.php

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

77
use DateInterval;
88
use Nyholm\Psr7\ServerRequest;
9+
use SimpleSAML\Assert\Assert;
910
use SimpleSAML\{Configuration, Error, Logger};
1011
use SimpleSAML\HTTP\RunnableResponse;
1112
use SimpleSAML\Metadata\MetaDataStorageHandler;
@@ -27,6 +28,7 @@
2728
};
2829
use SimpleSAML\SAML2\XML\samlp\{AttributeQuery, Response, Status, StatusCode};
2930
use SimpleSAML\Utils;
31+
use SimpleSAML\XML\Exception\InvalidDOMElementException;
3032
use SimpleSAML\XML\Utils\Random;
3133
use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory;
3234
use SimpleSAML\XMLSecurity\Key\PrivateKey;
@@ -83,6 +85,8 @@ public function setMetadataStorageHandler(MetaDataStorageHandler $handler): void
8385
public function main(/** @scrutinizer ignore-unused */ SOAP $soap, ServerRequest $request): RunnableResponse
8486
{
8587
$message = $soap->receive($request);
88+
Assert::isInstanceOf($message, AttributeQuery::class, InvalidDOMElement::class);
89+
8690
$idpEntityId = $this->metadataHandler->getMetaDataCurrentEntityID('saml20-idp-hosted');
8791

8892
$issuer = $message->getIssuer();

0 commit comments

Comments
 (0)