Issues (538)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/XML/samlp/AuthzDecisionQuery.php (7 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\samlp;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Constants as C;
0 ignored issues
show
The type SimpleSAML\SAML2\Constants 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException;
0 ignored issues
show
The type SimpleSAML\SAML2\Excepti...VersionTooHighException 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

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\SAML2\Exception\Protocol\RequestVersionTooLowException;
0 ignored issues
show
The type SimpleSAML\SAML2\Excepti...tVersionTooLowException 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
13
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
0 ignored issues
show
The type SimpleSAML\SAML2\Type\SAMLDateTimeValue 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use SimpleSAML\SAML2\Type\SAMLStringValue;
15
use SimpleSAML\SAML2\XML\saml\Action;
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use SimpleSAML\SAML2\XML\saml\Evidence;
17
use SimpleSAML\SAML2\XML\saml\Issuer;
18
use SimpleSAML\SAML2\XML\saml\Subject;
19
use SimpleSAML\XML\SchemaValidatableElementInterface;
20
use SimpleSAML\XML\SchemaValidatableElementTrait;
21
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
22
use SimpleSAML\XMLSchema\Exception\MissingElementException;
23
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
24
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
25
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\IDValue 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
use SimpleSAML\XMLSecurity\XML\ds\Signature;
27
28
use function version_compare;
29
30
/**
31
 * Class representing a SAML2 AuthzDecisionQuery
32
 *
33
 * @package simplesamlphp/saml2
34
 */
35
final class AuthzDecisionQuery extends AbstractSubjectQuery implements SchemaValidatableElementInterface
36
{
37
    use SchemaValidatableElementTrait;
38
39
40
    /**
41
     * Constructor for SAML 2 AuthzDecisionQuery.
42
     *
43
     * @param \SimpleSAML\XMLSchema\Type\IDValue $id
44
     * @param \SimpleSAML\SAML2\XML\saml\Subject $subject
45
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $resource
46
     * @param \SimpleSAML\SAML2\XML\saml\Action[] $action
47
     * @param \SimpleSAML\SAML2\XML\saml\Evidence $evidence
48
     * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer
49
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant
50
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination
51
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent
52
     * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions
53
     */
54
    public function __construct(
55
        IDVaLue $id,
56
        Subject $subject,
57
        SAMLDateTimeValue $issueInstant,
58
        protected SAMLAnyURIValue $resource,
59
        protected array $action,
60
        protected ?Evidence $evidence = null,
61
        ?Issuer $issuer = null,
62
        ?SAMLAnyURIValue $destination = null,
63
        ?SAMLAnyURIValue $consent = null,
64
        ?Extensions $extensions = null,
0 ignored issues
show
The type SimpleSAML\SAML2\XML\samlp\Extensions 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
65
    ) {
66
        Assert::maxCount($action, C::UNBOUNDED_LIMIT);
67
        Assert::allIsInstanceOf($action, Action::class, SchemaViolationException::class);
68
69
        parent::__construct($id, $subject, $issuer, $issueInstant, $destination, $consent, $extensions);
70
    }
71
72
73
    /**
74
     * Collect the value of the resource-property
75
     *
76
     * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue
77
     */
78
    public function getResource(): SAMLAnyURIValue
79
    {
80
        return $this->resource;
81
    }
82
83
84
    /**
85
     * Collect the value of the action-property
86
     *
87
     * @return \SimpleSAML\SAML2\XML\saml\Action[]
88
     */
89
    public function getAction(): array
90
    {
91
        return $this->action;
92
    }
93
94
95
    /**
96
     * Collect the value of the evidence-property
97
     *
98
     * @return \SimpleSAML\SAML2\XML\saml\Evidence|null
99
     */
100
    public function getEvidence(): ?Evidence
101
    {
102
        return $this->evidence;
103
    }
104
105
106
    /**
107
     * Convert XML into an AuthzDecisionQuery
108
     *
109
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
110
     *   if the qualified name of the supplied element is wrong
111
     * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException
112
     *   if one of the mandatory child-elements is missing
113
     * @throws \Exception if the authentication instant is not a valid timestamp.
114
     */
115
    public static function fromXML(DOMElement $xml): static
116
    {
117
        Assert::same($xml->localName, 'AuthzDecisionQuery', InvalidDOMElementException::class);
118
        Assert::same($xml->namespaceURI, AuthzDecisionQuery::NS, InvalidDOMElementException::class);
119
120
        $version = self::getAttribute($xml, 'Version', SAMLStringValue::class);
121
        Assert::true(version_compare('2.0', $version->getValue(), '<='), RequestVersionTooLowException::class);
122
        Assert::true(version_compare('2.0', $version->getValue(), '>='), RequestVersionTooHighException::class);
123
124
        $issuer = Issuer::getChildrenOfClass($xml);
125
        Assert::countBetween($issuer, 0, 1);
126
127
        $extensions = Extensions::getChildrenOfClass($xml);
128
        Assert::maxCount(
129
            $extensions,
130
            1,
131
            'Only one saml:Extensions element is allowed.',
132
            TooManyElementsException::class,
133
        );
134
135
        $subject = Subject::getChildrenOfClass($xml);
136
        Assert::notEmpty($subject, 'Missing subject in subject query.', MissingElementException::class);
137
        Assert::maxCount(
138
            $subject,
139
            1,
140
            'More than one <saml:Subject> in AuthzDecisionQuery',
141
            TooManyElementsException::class,
142
        );
143
144
        $action = Action::getChildrenOfClass($xml);
145
        Assert::minCount(
146
            $action,
147
            1,
148
            'Missing <saml:Action> in <saml:AuthzDecisionQuery>',
149
            MissingElementException::class,
150
        );
151
152
        $evidence = Evidence::getChildrenOfClass($xml);
153
        Assert::maxCount(
154
            $evidence,
155
            1,
156
            'Too many <saml:Evidence> in <saml:AuthzDecisionQuery>',
157
            TooManyElementsException::class,
158
        );
159
160
        $signature = Signature::getChildrenOfClass($xml);
161
        Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class);
162
163
        $request = new static(
164
            self::getAttribute($xml, 'ID', IDValue::class),
165
            array_pop($subject),
166
            self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class),
167
            self::getAttribute($xml, 'Resource', SAMLAnyURIValue::class),
168
            $action,
169
            array_pop($evidence),
170
            array_pop($issuer),
171
            self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null),
172
            self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null),
173
            array_pop($extensions),
174
        );
175
176
        if (!empty($signature)) {
177
            $request->setSignature($signature[0]);
178
            $request->setXML($xml);
179
        }
180
181
        return $request;
182
    }
183
184
185
    /**
186
     * Convert this message to an unsigned XML document.
187
     * This method does not sign the resulting XML document.
188
     */
189
    protected function toUnsignedXML(?DOMElement $parent = null): DOMElement
190
    {
191
        $e = parent::toUnsignedXML($parent);
192
        $e->setAttribute('Resource', $this->getResource()->getValue());
193
194
        foreach ($this->getAction() as $action) {
195
            $action->toXML($e);
196
        }
197
198
        if ($this->getEvidence() !== null && !$this->getEvidence()->isEmptyElement()) {
199
            $this->getEvidence()->toXML($e);
200
        }
201
202
        return $e;
203
    }
204
}
205