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/LogoutRequest.php (9 issues)

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\IdentifierTrait;
16
use SimpleSAML\SAML2\XML\saml\AbstractBaseID;
17
use SimpleSAML\SAML2\XML\saml\EncryptedID;
18
use SimpleSAML\SAML2\XML\saml\IdentifierInterface;
19
use SimpleSAML\SAML2\XML\saml\Issuer;
20
use SimpleSAML\SAML2\XML\saml\NameID;
21
use SimpleSAML\XML\SchemaValidatableElementInterface;
22
use SimpleSAML\XML\SchemaValidatableElementTrait;
23
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
24
use SimpleSAML\XMLSchema\Exception\MissingElementException;
25
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
26
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...
27
use SimpleSAML\XMLSecurity\XML\ds\Signature;
28
29
use function array_pop;
30
31
/**
32
 * Class for SAML 2 logout request messages.
33
 *
34
 * @package simplesamlphp/saml2
35
 */
36
final class LogoutRequest extends AbstractRequest implements SchemaValidatableElementInterface
37
{
38
    use IdentifierTrait;
39
    use SchemaValidatableElementTrait;
40
41
42
    /**
43
     * Constructor for SAML 2 AttributeQuery.
44
     *
45
     * @param \SimpleSAML\XMLSchema\Type\IDValue $id
46
     * @param \SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier
47
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant
48
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter
49
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $reason
50
     * @param \SimpleSAML\SAML2\XML\samlp\SessionIndex[] $sessionIndexes
51
     * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer
52
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination
53
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent
54
     * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions
55
     *
56
     * @throws \Exception
57
     */
58
    public function __construct(
59
        IDValue $id,
60
        IdentifierInterface $identifier,
61
        SAMLDateTimeValue $issueInstant,
62
        protected ?SAMLDateTimeValue $notOnOrAfter = null,
63
        protected ?SAMLStringValue $reason = null,
64
        protected array $sessionIndexes = [],
65
        ?Issuer $issuer = null,
66
        ?SAMLAnyURIValue $destination = null,
67
        ?SAMLAnyURIValue $consent = null,
68
        ?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...
69
    ) {
70
        Assert::maxCount($sessionIndexes, C::UNBOUNDED_LIMIT);
71
        Assert::allIsInstanceOf($sessionIndexes, SessionIndex::class);
0 ignored issues
show
The type SimpleSAML\SAML2\XML\samlp\SessionIndex 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...
72
73
        parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions);
74
75
        $this->setIdentifier($identifier);
76
    }
77
78
79
    /**
80
     * Retrieve the expiration time of this request.
81
     *
82
     * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null The expiration time of this request.
83
     */
84
    public function getNotOnOrAfter(): ?SAMLDateTimeValue
85
    {
86
        return $this->notOnOrAfter;
87
    }
88
89
90
    /**
91
     * Retrieve the reason for this request.
92
     *
93
     * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null The reason for this request.
94
     */
95
    public function getReason(): ?SAMLStringValue
96
    {
97
        return $this->reason;
98
    }
99
100
101
    /**
102
     * Retrieve the SessionIndexes of the sessions that should be terminated.
103
     *
104
     * @return \SimpleSAML\SAML2\XML\samlp\SessionIndex[]
105
     *   The SessionIndexes, or an empty array if all sessions should be terminated.
106
     */
107
    public function getSessionIndexes(): array
108
    {
109
        return $this->sessionIndexes;
110
    }
111
112
113
    /**
114
     * Convert XML into a LogoutRequest
115
     *
116
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
117
     *   if the qualified name of the supplied element is wrong
118
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
119
     *   if the supplied element is missing one of the mandatory attributes
120
     * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException
121
     *   if one of the mandatory child-elements is missing
122
     * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException
123
     *   if too many child-elements of a type are specified
124
     */
125
    public static function fromXML(DOMElement $xml): static
126
    {
127
        Assert::same($xml->localName, 'LogoutRequest', InvalidDOMElementException::class);
128
        Assert::same($xml->namespaceURI, LogoutRequest::NS, InvalidDOMElementException::class);
129
130
        $version = self::getAttribute($xml, 'Version', SAMLStringValue::class);
131
        Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class);
132
        Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class);
133
134
        $id = self::getAttribute($xml, 'ID', IDValue::Class);
135
        $issueInstant = self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class);
136
137
        $notOnOrAfter = self::getOptionalAttribute($xml, 'NotOnOrAfter', SAMLDateTimeValue::class, null);
138
139
        $issuer = Issuer::getChildrenOfClass($xml);
140
        Assert::countBetween($issuer, 0, 1);
141
142
        $extensions = Extensions::getChildrenOfClass($xml);
143
        Assert::maxCount(
144
            $extensions,
145
            1,
146
            'Only one saml:Extensions element is allowed.',
147
            TooManyElementsException::class,
148
        );
149
150
        $identifier = self::getIdentifierFromXML($xml);
151
        Assert::notNull(
152
            $identifier,
153
            'Missing <saml:NameID>, <saml:BaseID> or <saml:EncryptedID> in <samlp:LogoutRequest>.',
154
            MissingElementException::class,
155
        );
156
        Assert::isInstanceOfAny($identifier, [AbstractBaseID::class, NameID::class, EncryptedID::class]);
157
158
        $signature = Signature::getChildrenOfClass($xml);
159
        Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.');
160
161
        $sessionIndex = SessionIndex::getChildrenOfClass($xml);
162
163
        $request = new static(
164
            $id,
165
            $identifier,
0 ignored issues
show
It seems like $identifier can also be of type null; however, parameter $identifier of SimpleSAML\SAML2\XML\sam...tRequest::__construct() does only seem to accept SimpleSAML\SAML2\XML\saml\IdentifierInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

165
            /** @scrutinizer ignore-type */ $identifier,
Loading history...
166
            $issueInstant,
167
            $notOnOrAfter,
168
            self::getOptionalAttribute($xml, 'Reason', SAMLStringValue::class, null),
169
            $sessionIndex,
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->messageContainedSignatureUponConstruction = true;
179
            $request->setXML($xml);
180
        }
181
182
        return $request;
183
    }
184
185
186
    /**
187
     * Convert this message to an unsigned XML document.
188
     * This method does not sign the resulting XML document.
189
     */
190
    protected function toUnsignedXML(?DOMElement $parent = null): DOMElement
191
    {
192
        $e = parent::toUnsignedXML($parent);
193
194
        if ($this->getNotOnOrAfter() !== null) {
195
            $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->getValue());
196
        }
197
198
        if ($this->getReason() !== null) {
199
            $e->setAttribute('Reason', $this->getReason()->getValue());
200
        }
201
202
        $this->getIdentifier()->toXML($e);
0 ignored issues
show
The method toXML() does not exist on SimpleSAML\SAML2\XML\saml\IdentifierInterface. It seems like you code against a sub-type of said class. However, the method does not exist in SimpleSAML\SAML2\XML\saml\BaseIdentifierInterface. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

202
        $this->getIdentifier()->/** @scrutinizer ignore-call */ toXML($e);
Loading history...
203
204
        foreach ($this->getSessionIndexes() as $sessionIndex) {
205
            $sessionIndex->toXML($e);
206
        }
207
208
        return $e;
209
    }
210
}
211