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/mdrpi/RegistrationInfo.php (6 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\mdrpi;
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\ArrayValidationException;
11
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
12
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...
13
use SimpleSAML\SAML2\Type\SAMLStringValue;
14
use SimpleSAML\XML\ArrayizableElementInterface;
15
use SimpleSAML\XML\SchemaValidatableElementInterface;
16
use SimpleSAML\XML\SchemaValidatableElementTrait;
17
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
18
19
/**
20
 * Class for handling the mdrpi:RegistrationInfo element.
21
 *
22
 * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf
23
 *
24
 * @package simplesamlphp/saml2
25
 */
26
final class RegistrationInfo extends AbstractMdrpiElement implements
0 ignored issues
show
The type SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement 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
    ArrayizableElementInterface,
28
    SchemaValidatableElementInterface
29
{
30
    use SchemaValidatableElementTrait;
31
32
33
    /**
34
     * Create/parse a mdrpi:RegistrationInfo element.
35
     *
36
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue $registrationAuthority
37
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $registrationInstant
38
     * @param \SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy[] $registrationPolicy
39
     */
40
    public function __construct(
41
        protected SAMLStringValue $registrationAuthority,
42
        protected ?SAMLDateTimeValue $registrationInstant = null,
43
        protected array $registrationPolicy = [],
44
    ) {
45
        Assert::maxCount($registrationPolicy, C::UNBOUNDED_LIMIT);
46
        Assert::allIsInstanceOf($registrationPolicy, RegistrationPolicy::class);
0 ignored issues
show
The type SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy 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...
47
48
        /**
49
         * 2.1.1:  There MUST NOT be more than one <mdrpi:RegistrationPolicy>,
50
         *         within a given <mdrpi:RegistrationInfo>, for a given language
51
         */
52
        $languages = array_map(
53
            function ($rp) {
54
                return $rp->getLanguage();
55
            },
56
            $registrationPolicy,
57
        );
58
        Assert::uniqueValues(
59
            $languages,
60
            'There MUST NOT be more than one <mdrpi:RegistrationPolicy>,'
61
            . ' within a given <mdrpi:RegistrationInfo>, for a given language',
62
            ProtocolViolationException::class,
63
        );
64
    }
65
66
67
    /**
68
     * Collect the value of the RegistrationAuthority property
69
     *
70
     * @return \SimpleSAML\SAML2\Type\SAMLStringValue
71
     */
72
    public function getRegistrationAuthority(): SAMLStringValue
73
    {
74
        return $this->registrationAuthority;
75
    }
76
77
78
    /**
79
     * Collect the value of the registrationInstant property
80
     *
81
     * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null
82
     */
83
    public function getRegistrationInstant(): ?SAMLDateTimeValue
84
    {
85
        return $this->registrationInstant;
86
    }
87
88
89
    /**
90
     * Collect the value of the RegistrationPolicy property
91
     *
92
     * @return \SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy[]
93
     */
94
    public function getRegistrationPolicy(): array
95
    {
96
        return $this->registrationPolicy;
97
    }
98
99
100
    /**
101
     * Convert XML into a RegistrationInfo
102
     *
103
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
104
     *   if the qualified name of the supplied element is wrong
105
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
106
     *   if the supplied element is missing one of the mandatory attributes
107
     */
108
    public static function fromXML(DOMElement $xml): static
109
    {
110
        Assert::same($xml->localName, 'RegistrationInfo', InvalidDOMElementException::class);
111
        Assert::same($xml->namespaceURI, RegistrationInfo::NS, InvalidDOMElementException::class);
112
113
        $registrationAuthority = self::getAttribute($xml, 'registrationAuthority', SAMLStringValue::class);
114
        $registrationInstant = self::getOptionalAttribute($xml, 'registrationInstant', SAMLDateTimeValue::class, null);
115
        $RegistrationPolicy = RegistrationPolicy::getChildrenOfClass($xml);
116
117
        return new static($registrationAuthority, $registrationInstant, $RegistrationPolicy);
118
    }
119
120
121
    /**
122
     * Convert this element to XML.
123
     */
124
    public function toXML(?DOMElement $parent = null): DOMElement
125
    {
126
        $e = $this->instantiateParentElement($parent);
127
        $e->setAttribute('registrationAuthority', $this->getRegistrationAuthority()->getValue());
128
129
        if ($this->getRegistrationInstant() !== null) {
130
            $e->setAttribute('registrationInstant', $this->getRegistrationInstant()->getValue());
131
        }
132
133
        foreach ($this->getRegistrationPolicy() as $rp) {
134
            $rp->toXML($e);
135
        }
136
137
        return $e;
138
    }
139
140
141
    /**
142
     * Create a class from an array
143
     *
144
     * @param array{
145
     *   'registrationAuthority': string,
146
     *   'registrationInstant'?: string,
147
     *   'RegistrationPolicy'?: array,
148
     * } $data
149
     */
150
    public static function fromArray(array $data): static
151
    {
152
        $data = self::processArrayContents($data);
153
154
        return new static(
155
            SAMLStringValue::fromString($data['registrationAuthority']),
156
            $data['registrationInstant'] !== null ? SAMLDateTimeValue::fromString($data['registrationInstant']) : null,
157
            $data['RegistrationPolicy'] ?? [],
158
        );
159
    }
160
161
162
    /**
163
     * Validates an array representation of this object and returns the same array with
164
     * rationalized keys (casing) and parsed sub-elements.
165
     *
166
     * @param array{
167
     *   'registrationAuthority': string,
168
     *   'registrationInstant'?: string,
169
     *   'RegistrationPolicy'?: array,
170
     * } $data
171
     * @return array{
0 ignored issues
show
Documentation Bug introduced by
The doc comment array{ at position 2 could not be parsed: the token is null at position 2.
Loading history...
172
     *   'registrationAuthority': string,
173
     *   'registrationInstant'?: string,
174
     *   'RegistrationPolicy'?: array,
175
     * }
176
     */
177
    private static function processArrayContents(array $data): array
178
    {
179
        $data = array_change_key_case($data, CASE_LOWER);
180
181
        Assert::allOneOf(
182
            array_keys($data),
183
            ['registrationauthority', 'registrationinstant', 'registrationpolicy'],
184
            ArrayValidationException::class,
185
        );
186
187
        Assert::keyExists($data, 'registrationauthority', ArrayValidationException::class);
188
        Assert::string($data['registrationauthority'], ArrayValidationException::class);
189
        $retval = ['registrationAuthority' => $data['registrationauthority']];
190
191
        if (array_key_exists('registrationinstant', $data)) {
192
            Assert::string($data['registrationinstant'], ArrayValidationException::class);
193
            Assert::validSAMLDateTime($data['registrationinstant'], ArrayValidationException::class);
194
            $retval['registrationInstant'] = $data['registrationinstant'];
195
        }
196
197
        if (array_key_exists('registrationpolicy', $data)) {
198
            Assert::isArray($data['registrationpolicy'], ArrayValidationException::class);
199
            foreach ($data['registrationpolicy'] as $lang => $rp) {
200
                $retval['RegistrationPolicy'][] = RegistrationPolicy::fromArray([$lang => $rp]);
201
            }
202
        }
203
204
        return $retval;
205
    }
206
207
208
    /**
209
     * Create an array from this class
210
     *
211
     * @return array{
0 ignored issues
show
Documentation Bug introduced by
The doc comment array{ at position 2 could not be parsed: the token is null at position 2.
Loading history...
212
     *   'registrationAuthority': string,
213
     *   'registrationInstant'?: string,
214
     *   'RegistrationPolicy'?: array,
215
     * }
216
     */
217
    public function toArray(): array
218
    {
219
        $data = [];
220
        $data['registrationAuthority'] = $this->getRegistrationAuthority()->getValue();
221
222
        if ($this->getRegistrationInstant() !== null) {
223
            $data['registrationInstant'] = $this->getRegistrationInstant()->getValue();
224
        }
225
226
        if (!empty($this->getRegistrationPolicy())) {
227
            $data['RegistrationPolicy'] = [];
228
            foreach ($this->getRegistrationPolicy() as $rp) {
229
                $data['RegistrationPolicy'] = array_merge($data['RegistrationPolicy'], $rp->toArray());
230
            }
231
        }
232
233
        return $data;
234
    }
235
}
236