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\saml; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\SAML2\Assert\Assert; |
||
| 9 | use SimpleSAML\SAML2\Constants as C; |
||
|
0 ignored issues
–
show
|
|||
| 10 | use SimpleSAML\SAML2\Type\DecisionTypeValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\Type\DecisionTypeValue 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...
|
|||
| 11 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
||
| 12 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 13 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 14 | use SimpleSAML\XMLSchema\Exception\MissingElementException; |
||
| 15 | use SimpleSAML\XMLSchema\Exception\SchemaViolationException; |
||
| 16 | use SimpleSAML\XMLSchema\Exception\TooManyElementsException; |
||
| 17 | use SimpleSAML\XMLSchema\Type\AnyURIValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\AnyURIValue 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...
|
|||
| 18 | |||
| 19 | use function array_pop; |
||
| 20 | use function strval; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Class representing a SAML2 AuthzDecisionStatement |
||
| 24 | * |
||
| 25 | * @package simplesamlphp/saml2 |
||
| 26 | */ |
||
| 27 | final class AuthzDecisionStatement extends AbstractStatementType implements SchemaValidatableElementInterface |
||
| 28 | { |
||
| 29 | use SchemaValidatableElementTrait; |
||
| 30 | |||
| 31 | |||
| 32 | /** |
||
| 33 | * Initialize an AuthzDecisionStatement. |
||
| 34 | * |
||
| 35 | * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $resource |
||
| 36 | * @param \SimpleSAML\SAML2\Type\DecisionTypeValue $decision |
||
| 37 | * @param \SimpleSAML\SAML2\XML\saml\Action[] $action |
||
| 38 | * @param \SimpleSAML\SAML2\XML\saml\Evidence|null $evidence |
||
| 39 | */ |
||
| 40 | public function __construct( |
||
| 41 | // Uses the base AnyURIValue because the SAML-specification allows this attribute to be an empty string |
||
| 42 | protected AnyURIValue $resource, |
||
| 43 | protected DecisionTypeValue $decision, |
||
| 44 | protected array $action, |
||
| 45 | protected ?Evidence $evidence = null, |
||
| 46 | ) { |
||
| 47 | Assert::maxCount($action, C::UNBOUNDED_LIMIT); |
||
| 48 | Assert::allIsInstanceOf($action, Action::class, SchemaViolationException::class); |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\saml\Action 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...
|
|||
| 49 | } |
||
| 50 | |||
| 51 | |||
| 52 | /** |
||
| 53 | * Collect the value of the resource-property |
||
| 54 | * |
||
| 55 | * @return \SimpleSAML\XMLSchema\Type\AnyURIValue |
||
| 56 | */ |
||
| 57 | public function getResource(): AnyURIValue |
||
| 58 | { |
||
| 59 | return $this->resource; |
||
| 60 | } |
||
| 61 | |||
| 62 | |||
| 63 | /** |
||
| 64 | * Collect the value of the decision-property |
||
| 65 | * |
||
| 66 | * @return \SimpleSAML\SAML2\Type\DecisionTypeValue |
||
| 67 | */ |
||
| 68 | public function getDecision(): DecisionTypeValue |
||
| 69 | { |
||
| 70 | return $this->decision; |
||
| 71 | } |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * Collect the value of the action-property |
||
| 76 | * |
||
| 77 | * @return \SimpleSAML\SAML2\XML\saml\Action[] |
||
| 78 | */ |
||
| 79 | public function getAction(): array |
||
| 80 | { |
||
| 81 | return $this->action; |
||
| 82 | } |
||
| 83 | |||
| 84 | |||
| 85 | /** |
||
| 86 | * Collect the value of the evidence-property |
||
| 87 | * |
||
| 88 | * @return \SimpleSAML\SAML2\XML\saml\Evidence|null |
||
| 89 | */ |
||
| 90 | public function getEvidence(): ?Evidence |
||
| 91 | { |
||
| 92 | return $this->evidence; |
||
| 93 | } |
||
| 94 | |||
| 95 | |||
| 96 | /** |
||
| 97 | * Convert XML into an AuthzDecisionStatement |
||
| 98 | * |
||
| 99 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 100 | * if the qualified name of the supplied element is wrong |
||
| 101 | * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException |
||
| 102 | * if one of the mandatory child-elements is missing |
||
| 103 | * @throws \Exception if the authentication instant is not a valid timestamp. |
||
| 104 | */ |
||
| 105 | public static function fromXML(DOMElement $xml): static |
||
| 106 | { |
||
| 107 | Assert::same($xml->localName, 'AuthzDecisionStatement', InvalidDOMElementException::class); |
||
| 108 | Assert::same($xml->namespaceURI, AuthzDecisionStatement::NS, InvalidDOMElementException::class); |
||
| 109 | |||
| 110 | $action = Action::getChildrenOfClass($xml); |
||
| 111 | Assert::minCount( |
||
| 112 | $action, |
||
| 113 | 1, |
||
| 114 | 'Missing <saml:Action> in <saml:AuthzDecisionStatement>', |
||
| 115 | MissingElementException::class, |
||
| 116 | ); |
||
| 117 | |||
| 118 | $evidence = Evidence::getChildrenOfClass($xml); |
||
| 119 | Assert::maxCount( |
||
| 120 | $evidence, |
||
| 121 | 1, |
||
| 122 | 'Too many <saml:Evidence> in <saml:AuthzDecisionStatement>', |
||
| 123 | TooManyElementsException::class, |
||
| 124 | ); |
||
| 125 | |||
| 126 | |||
| 127 | return new static( |
||
| 128 | self::getAttribute($xml, 'Resource', AnyURIValue::class), |
||
| 129 | self::getAttribute($xml, 'Decision', DecisionTypeValue::class), |
||
| 130 | $action, |
||
| 131 | array_pop($evidence), |
||
| 132 | ); |
||
| 133 | } |
||
| 134 | |||
| 135 | |||
| 136 | /** |
||
| 137 | * Convert this AuthzDecisionStatement to XML. |
||
| 138 | */ |
||
| 139 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 140 | { |
||
| 141 | $e = $this->instantiateParentElement($parent); |
||
| 142 | |||
| 143 | $e->setAttribute('Resource', strval($this->getResource())); |
||
| 144 | $e->setAttribute('Decision', strval($this->getDecision())); |
||
| 145 | |||
| 146 | foreach ($this->getAction() as $action) { |
||
| 147 | $action->toXML($e); |
||
| 148 | } |
||
| 149 | |||
| 150 | if ($this->getEvidence() !== null && !$this->getEvidence()->isEmptyElement()) { |
||
| 151 | $this->getEvidence()->toXML($e); |
||
| 152 | } |
||
| 153 | |||
| 154 | return $e; |
||
| 155 | } |
||
| 156 | } |
||
| 157 |
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