Skip to content

Commit d5d6a97

Browse files
committed
Fix CI: move vulnerability-test to a separate class
1 parent b8ca3ea commit d5d6a97

File tree

3 files changed

+51
-26
lines changed

3 files changed

+51
-26
lines changed

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<testsuites>
99
<testsuite name="Test Suite">
1010
<directory>./tests/SAML2</directory>
11+
<directory>./tests/Vulnerabilities</directory>
1112
</testsuite>
1213
</testsuites>
1314
<logging/>

tests/SAML2/Response/SignatureValidationTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -184,32 +184,6 @@ public function testThatAnUnsignedResponseWithNoSignedAssertionsThrowsAnExceptio
184184
}
185185

186186

187-
/**
188-
* CVE-2025-66475
189-
*/
190-
#[PreserveGlobalState(false)]
191-
#[RunInSeparateProcess]
192-
public function testSignedResponseWithStrayXmlnsThrowsAnException(): void
193-
{
194-
$doc = DOMDocumentFactory::fromFile(
195-
dirname(__DIR__, 2) . '/resources/xml/vulnerabilities/CVE-2025-66475.xml',
196-
);
197-
198-
$response = Response::fromXML($doc->documentElement);
199-
$assertion = $response->getAssertions()[0];
200-
201-
$verifier = (new SignatureAlgorithmFactory())->getAlgorithm(
202-
$assertion->getSignature()->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(),
203-
new PublicKey(
204-
new PEM(PEM::TYPE_PUBLIC_KEY, $assertion->getSignature()->getKeyInfo()->getInfo()[0]->getData()[0]->getContent()->getValue()),
205-
),
206-
);
207-
208-
$this->expectException(CanonicalizationFailedException::class);
209-
$assertion->verify($verifier);
210-
}
211-
212-
213187
/**
214188
* @return \SimpleSAML\SAML2\XML\samlp\Response
215189
*/
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\Test\SAML2\Response;
6+
7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\Group;
9+
use PHPUnit\Framework\TestCase;
10+
use SimpleSAML\SAML2\XML\samlp\Response;
11+
use SimpleSAML\XML\DOMDocumentFactory;
12+
use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory;
13+
use SimpleSAML\XMLSecurity\CryptoEncoding\PEM;
14+
use SimpleSAML\XMLSecurity\Exception\CanonicalizationFailedException;
15+
use SimpleSAML\XMLSecurity\Key\PublicKey;
16+
use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock;
17+
18+
use function dirname;
19+
20+
/**
21+
* CVE-2025-66475
22+
*
23+
* @package simplesamlphp/saml2
24+
*/
25+
#[Group('vulnerabilities')]
26+
#[CoversClass(ResponseProcessor::class)]
27+
final class GoldenSAMLResponseTest extends TestCase
28+
{
29+
/**
30+
*/
31+
public function testSignedResponseWithStrayXmlnsThrowsAnException(): void
32+
{
33+
$doc = DOMDocumentFactory::fromFile(
34+
dirname(__DIR__, 1) . '/resources/xml/vulnerabilities/CVE-2025-66475.xml',
35+
);
36+
37+
$response = Response::fromXML($doc->documentElement);
38+
$assertion = $response->getAssertions()[0];
39+
40+
$verifier = (new SignatureAlgorithmFactory())->getAlgorithm(
41+
$assertion->getSignature()->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(),
42+
new PublicKey(
43+
new PEM(PEM::TYPE_PUBLIC_KEY, $assertion->getSignature()->getKeyInfo()->getInfo()[0]->getData()[0]->getContent()->getValue()),
44+
),
45+
);
46+
47+
$this->expectException(CanonicalizationFailedException::class);
48+
@$assertion->verify($verifier);
49+
}
50+
}

0 commit comments

Comments
 (0)