simplesamlphp /
saml2
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\SAML2\XML\md; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\SAML2\Assert\Assert; |
||
| 9 | use SimpleSAML\XML\Constants as C; |
||
|
0 ignored issues
–
show
|
|||
| 10 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
||
| 11 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 12 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 13 | use SimpleSAML\XMLSchema\Exception\MissingElementException; |
||
| 14 | use SimpleSAML\XMLSchema\Type\BooleanValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\BooleanValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use SimpleSAML\XMLSchema\Type\UnsignedShortValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\UnsignedShortValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | |||
| 17 | use function var_export; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Class representing SAML 2 Metadata AttributeConsumingService element. |
||
| 21 | * |
||
| 22 | * @package simplesamlphp/saml2 |
||
| 23 | */ |
||
| 24 | final class AttributeConsumingService extends AbstractMdElement implements SchemaValidatableElementInterface |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\md\AbstractMdElement was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 25 | { |
||
| 26 | use IndexedElementTrait; |
||
| 27 | use SchemaValidatableElementTrait; |
||
| 28 | |||
| 29 | |||
| 30 | /** |
||
| 31 | * AttributeConsumingService constructor. |
||
| 32 | * |
||
| 33 | * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index |
||
| 34 | * @param \SimpleSAML\SAML2\XML\md\ServiceName[] $serviceName |
||
| 35 | * @param \SimpleSAML\SAML2\XML\md\RequestedAttribute[] $requestedAttribute |
||
| 36 | * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault |
||
| 37 | * @param \SimpleSAML\SAML2\XML\md\ServiceDescription[] $serviceDescription |
||
| 38 | */ |
||
| 39 | public function __construct( |
||
| 40 | UnsignedShortValue $index, |
||
| 41 | protected array $serviceName, |
||
| 42 | protected array $requestedAttribute, |
||
| 43 | ?BooleanValue $isDefault = null, |
||
| 44 | protected array $serviceDescription = [], |
||
| 45 | ) { |
||
| 46 | Assert::maxCount($serviceName, C::UNBOUNDED_LIMIT); |
||
| 47 | Assert::minCount( |
||
| 48 | $serviceName, |
||
| 49 | 1, |
||
| 50 | 'Missing at least one ServiceName in AttributeConsumingService.', |
||
| 51 | MissingElementException::class, |
||
| 52 | ); |
||
| 53 | Assert::allIsInstanceOf( |
||
| 54 | $serviceName, |
||
| 55 | ServiceName::class, |
||
| 56 | 'Service names must be specified as ServiceName objects.', |
||
| 57 | ); |
||
| 58 | Assert::maxCount($serviceDescription, C::UNBOUNDED_LIMIT); |
||
| 59 | Assert::allIsInstanceOf( |
||
| 60 | $serviceDescription, |
||
| 61 | ServiceDescription::class, |
||
| 62 | 'Service descriptions must be specified as ServiceDescription objects.', |
||
| 63 | ); |
||
| 64 | Assert::maxCount($requestedAttribute, C::UNBOUNDED_LIMIT); |
||
| 65 | Assert::allIsInstanceOf( |
||
| 66 | $requestedAttribute, |
||
| 67 | RequestedAttribute::class, |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\md\RequestedAttribute was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 68 | 'Requested attributes must be specified as RequestedAttribute objects.', |
||
| 69 | ); |
||
| 70 | Assert::minCount( |
||
| 71 | $requestedAttribute, |
||
| 72 | 1, |
||
| 73 | 'Missing at least one RequestedAttribute in AttributeConsumingService.', |
||
| 74 | MissingElementException::class, |
||
| 75 | ); |
||
| 76 | |||
| 77 | $this->setIndex($index); |
||
| 78 | $this->setIsDefault($isDefault); |
||
| 79 | } |
||
| 80 | |||
| 81 | |||
| 82 | /** |
||
| 83 | * Get the localized names of this service. |
||
| 84 | * |
||
| 85 | * @return \SimpleSAML\SAML2\XML\md\ServiceName[] |
||
| 86 | */ |
||
| 87 | public function getServiceName(): array |
||
| 88 | { |
||
| 89 | return $this->serviceName; |
||
| 90 | } |
||
| 91 | |||
| 92 | |||
| 93 | /** |
||
| 94 | * Collect the value of the ServiceDescription-property |
||
| 95 | * |
||
| 96 | * @return \SimpleSAML\SAML2\XML\md\ServiceDescription[] |
||
| 97 | */ |
||
| 98 | public function getServiceDescription(): array |
||
| 99 | { |
||
| 100 | return $this->serviceDescription; |
||
| 101 | } |
||
| 102 | |||
| 103 | |||
| 104 | /** |
||
| 105 | * Collect the value of the RequestedAttribute-property |
||
| 106 | * |
||
| 107 | * @return \SimpleSAML\SAML2\XML\md\RequestedAttribute[] |
||
| 108 | */ |
||
| 109 | public function getRequestedAttribute(): array |
||
| 110 | { |
||
| 111 | return $this->requestedAttribute; |
||
| 112 | } |
||
| 113 | |||
| 114 | |||
| 115 | /** |
||
| 116 | * Initialize / parse an AttributeConsumingService. |
||
| 117 | * |
||
| 118 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 119 | * if the qualified name of the supplied element is wrong |
||
| 120 | * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException |
||
| 121 | * if one of the mandatory child-elements is missing |
||
| 122 | */ |
||
| 123 | public static function fromXML(DOMElement $xml): static |
||
| 124 | { |
||
| 125 | Assert::same($xml->localName, 'AttributeConsumingService', InvalidDOMElementException::class); |
||
| 126 | Assert::same($xml->namespaceURI, AttributeConsumingService::NS, InvalidDOMElementException::class); |
||
| 127 | |||
| 128 | $names = ServiceName::getChildrenOfClass($xml); |
||
| 129 | Assert::minCount( |
||
| 130 | $names, |
||
| 131 | 1, |
||
| 132 | 'Missing at least one ServiceName in AttributeConsumingService.', |
||
| 133 | MissingElementException::class, |
||
| 134 | ); |
||
| 135 | |||
| 136 | $descriptions = ServiceDescription::getChildrenOfClass($xml); |
||
| 137 | |||
| 138 | $requestedAttrs = RequestedAttribute::getChildrenOfClass($xml); |
||
| 139 | |||
| 140 | return new static( |
||
| 141 | self::getAttribute($xml, 'index', UnsignedShortValue::class), |
||
| 142 | $names, |
||
| 143 | $requestedAttrs, |
||
| 144 | self::getOptionalAttribute($xml, 'isDefault', BooleanValue::class, null), |
||
| 145 | $descriptions, |
||
| 146 | ); |
||
| 147 | } |
||
| 148 | |||
| 149 | |||
| 150 | /** |
||
| 151 | * Convert to \DOMElement. |
||
| 152 | */ |
||
| 153 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 154 | { |
||
| 155 | $e = $this->instantiateParentElement($parent); |
||
| 156 | $e->setAttribute('index', $this->getIndex()->getValue()); |
||
| 157 | |||
| 158 | if ($this->getIsDefault() !== null) { |
||
| 159 | $e->setAttribute('isDefault', var_export($this->getIsDefault()->toBoolean(), true)); |
||
| 160 | } |
||
| 161 | |||
| 162 | foreach ($this->getServiceName() as $name) { |
||
| 163 | $name->toXML($e); |
||
| 164 | } |
||
| 165 | foreach ($this->getServiceDescription() as $description) { |
||
| 166 | $description->toXML($e); |
||
| 167 | } |
||
| 168 | foreach ($this->getRequestedAttribute() as $ra) { |
||
| 169 | $ra->toXML($e); |
||
| 170 | } |
||
| 171 | |||
| 172 | return $e; |
||
| 173 | } |
||
| 174 | } |
||
| 175 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths