Skip to content

Commit bac9ee2

Browse files
committed
Fix assertions; ID is required
1 parent 0bc6681 commit bac9ee2

10 files changed

Lines changed: 10 additions & 11 deletions

src/SAML2/XML/saml/Assertion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static function fromXML(DOMElement $xml): static
265265
Assert::same(self::getAttribute($xml, 'Version'), '2.0', 'Unsupported version: %s');
266266

267267
$id = self::getAttribute($xml, 'ID');
268-
Assert::nullOrValidNCName($id); // Covers the empty string
268+
Assert::validNCName($id); // Covers the empty string
269269

270270
$issueInstant = self::getAttribute($xml, 'IssueInstant');
271271
// Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications

src/SAML2/XML/samlp/ArtifactResolve.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static
9494
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
9595

9696
$id = self::getAttribute($xml, 'ID');
97-
Assert::nullOrValidNCName($id); // Covers the empty string
97+
Assert::validNCName($id); // Covers the empty string
9898

9999
$issueInstant = self::getAttribute($xml, 'IssueInstant');
100100
// Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications

src/SAML2/XML/samlp/ArtifactResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static function fromXML(DOMElement $xml): static
100100
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
101101

102102
$id = self::getAttribute($xml, 'ID');
103-
Assert::nullOrValidNCName($id); // Covers the empty string
103+
Assert::validNCName($id); // Covers the empty string
104104

105105
$inResponseTo = self::getAttribute($xml, 'InResponseTo', null);
106106
$destination = self::getAttribute($xml, 'Destination', null);

src/SAML2/XML/samlp/AssertionIDRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static function fromXML(DOMElement $xml): static
104104
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
105105

106106
$id = self::getAttribute($xml, 'ID');
107-
Assert::nullOrValidNCName($id); // Covers the empty string
107+
Assert::validNCName($id); // Covers the empty string
108108

109109
/** @psalm-var string $issueInstant */
110110
$issueInstant = self::getAttribute($xml, 'IssueInstant');

src/SAML2/XML/samlp/AttributeQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static function fromXML(DOMElement $xml): static
120120
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
121121

122122
$id = self::getAttribute($xml, 'ID');
123-
Assert::nullOrValidNCName($id); // Covers the empty string
123+
Assert::validNCName($id); // Covers the empty string
124124

125125
$destination = self::getAttribute($xml, 'Destination', null);
126126
$consent = self::getAttribute($xml, 'Consent', null);

src/SAML2/XML/samlp/AuthnQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function fromXML(DOMElement $xml): static
106106
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
107107

108108
$id = self::getAttribute($xml, 'ID');
109-
Assert::nullOrValidNCName($id); // Covers the empty string
109+
Assert::validNCName($id); // Covers the empty string
110110

111111
$destination = self::getAttribute($xml, 'Destination', null);
112112
$consent = self::getAttribute($xml, 'Consent', null);

src/SAML2/XML/samlp/AuthnRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static function fromXML(DOMElement $xml): static
250250
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
251251

252252
$id = self::getAttribute($xml, 'ID');
253-
Assert::nullOrValidNCName($id); // Covers the empty string
253+
Assert::validNCName($id); // Covers the empty string
254254

255255
$issueInstant = self::getAttribute($xml, 'IssueInstant');
256256
// Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications

src/SAML2/XML/samlp/LogoutRequest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function __construct(
6565
?string $consent = null,
6666
?Extensions $extensions = null,
6767
) {
68-
Assert::nullOrValidURI($reason, SchemaViolationException::class);
6968
Assert::allIsInstanceOf($sessionIndexes, SessionIndex::class);
7069

7170
parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions);
@@ -133,7 +132,7 @@ public static function fromXML(DOMElement $xml): static
133132
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
134133

135134
$id = self::getAttribute($xml, 'ID');
136-
Assert::nullOrValidNCName($id); // Covers the empty string
135+
Assert::validNCName($id); // Covers the empty string
137136

138137
$issueInstant = self::getAttribute($xml, 'IssueInstant');
139138
// Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications

src/SAML2/XML/samlp/LogoutResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static function fromXML(DOMElement $xml): static
8787
Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class);
8888

8989
$id = self::getAttribute($xml, 'ID');
90-
Assert::nullOrValidNCName($id); // Covers the empty string
90+
Assert::validNCName($id); // Covers the empty string
9191

9292
$issueInstant = self::getAttribute($xml, 'IssueInstant');
9393
// Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications

src/SAML2/XML/samlp/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function fromXML(DOMElement $xml): static
109109
Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class);
110110

111111
$id = self::getAttribute($xml, 'ID');
112-
Assert::nullOrValidNCName($id); // Covers the empty string
112+
Assert::validNCName($id); // Covers the empty string
113113

114114
$inResponseTo = self::getAttribute($xml, 'InResponseTo', null);
115115
$destination = self::getAttribute($xml, 'Destination', null);

0 commit comments

Comments
 (0)