Skip to content

Commit caca9ac

Browse files
committed
Fix CI: move vulnerability-test to a separate class
1 parent 611358b commit caca9ac

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
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/>
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)