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/IDPEntry.php (4 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\Exception\ArrayValidationException;
10
use SimpleSAML\SAML2\Type\EntityIDValue;
0 ignored issues
show
The type SimpleSAML\SAML2\Type\EntityIDValue 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\Type\SAMLAnyURIValue;
12
use SimpleSAML\SAML2\Type\SAMLStringValue;
13
use SimpleSAML\XML\SchemaValidatableElementInterface;
14
use SimpleSAML\XML\SchemaValidatableElementTrait;
15
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
16
17
use function array_change_key_case;
18
use function array_filter;
19
use function array_key_exists;
20
use function array_keys;
21
22
/**
23
 * Class for handling SAML2 IDPEntry.
24
 *
25
 * @package simplesamlphp/saml2
26
 */
27
final class IDPEntry extends AbstractSamlpElement implements SchemaValidatableElementInterface
0 ignored issues
show
The type SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement 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...
28
{
29
    use SchemaValidatableElementTrait;
30
31
32
    /**
33
     * Initialize an IDPEntry element.
34
     *
35
     * @param \SimpleSAML\SAML2\Type\EntityIDValue $providerId
36
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $name
37
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $loc
38
     */
39
    public function __construct(
40
        protected EntityIDValue $providerId,
41
        protected ?SAMLStringValue $name = null,
42
        protected ?SAMLAnyURIValue $loc = null,
43
    ) {
44
    }
45
46
47
    /**
48
     * @return \SimpleSAML\SAML2\Type\EntityIDValue
49
     */
50
    public function getProviderId(): EntityIDValue
51
    {
52
        return $this->providerId;
53
    }
54
55
56
    /**
57
     * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null
58
     */
59
    public function getName(): ?SAMLStringValue
60
    {
61
        return $this->name;
62
    }
63
64
65
    /**
66
     * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null
67
     */
68
    public function getLoc(): ?SAMLAnyURIValue
69
    {
70
        return $this->loc;
71
    }
72
73
74
    /**
75
     * Convert XML into a IDPEntry-element
76
     *
77
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
78
     *   if the qualified name of the supplied element is wrong
79
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
80
     *   if the supplied element is missing one of the mandatory attributes
81
     */
82
    public static function fromXML(DOMElement $xml): static
83
    {
84
        Assert::same($xml->localName, 'IDPEntry', InvalidDOMElementException::class);
85
        Assert::same($xml->namespaceURI, IDPEntry::NS, InvalidDOMElementException::class);
86
87
        return new static(
88
            self::getAttribute($xml, 'ProviderID', EntityIDValue::class),
89
            self::getOptionalAttribute($xml, 'Name', SAMLStringValue::class, null),
90
            self::getOptionalAttribute($xml, 'Loc', SAMLAnyURIValue::class, null),
91
        );
92
    }
93
94
95
    /**
96
     * Convert this IDPEntry to XML.
97
     */
98
    public function toXML(?DOMElement $parent = null): DOMElement
99
    {
100
        $e = $this->instantiateParentElement($parent);
101
        $e->setAttribute('ProviderID', $this->getProviderId()->getValue());
102
103
        if ($this->getName() !== null) {
104
            $e->setAttribute('Name', $this->getName()->getValue());
105
        }
106
107
        if ($this->getLoc() !== null) {
108
            $e->setAttribute('Loc', $this->getLoc()->getValue());
109
        }
110
111
        return $e;
112
    }
113
114
115
    /**
116
     * Create a class from an array
117
     *
118
     * @param array{
119
     *   'ProviderID': string,
120
     *   'Name'?: string,
121
     *   'Loc'?: string,
122
     * } $data
123
     */
124
    public static function fromArray(array $data): static
125
    {
126
        $data = self::processArrayContents($data);
127
128
        return new static(
129
            EntityIDValue::fromString($data['ProviderID']),
130
            $data['Name'] !== null ? SAMLStringValue::fromString($data['Name']) : null,
131
            $data['Loc'] !== null ? SAMLAnyURIValue::fromString($data['Loc']) : null,
132
        );
133
    }
134
135
136
    /**
137
     * Validates an array representation of this object and returns the same array with
138
     * rationalized keys (casing) and parsed sub-elements.
139
     *
140
     * @param array{
141
     *   'ProviderID': string,
142
     *   'Name'?: string,
143
     *   'Loc'?: string,
144
     * } $data
145
     * @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...
146
     *   'ProviderID': string,
147
     *   'Name'?: string,
148
     *   'Loc'?: string,
149
     * }
150
     */
151
    private static function processArrayContents(array $data): array
152
    {
153
        $data = array_change_key_case($data, CASE_LOWER);
154
155
        // Make sure the array keys are known for this kind of object
156
        Assert::allOneOf(
157
            array_keys($data),
158
            [
159
                'providerid',
160
                'name',
161
                'loc',
162
            ],
163
            ArrayValidationException::class,
164
        );
165
166
        Assert::keyExists($data, 'providerid', ArrayValidationException::class);
167
        Assert::string($data['providerid'], ArrayValidationException::class);
168
169
        $retval = ['ProviderID' => $data['providerid']];
170
171
        if (array_key_exists('name', $data)) {
172
            Assert::string($data['name'], ArrayValidationException::class);
173
            $retval['Name'] = $data['name'];
174
        }
175
176
        if (array_key_exists('loc', $data)) {
177
            Assert::string($data['loc'], ArrayValidationException::class);
178
            $retval['Loc'] = $data['loc'];
179
        }
180
181
        return $retval;
182
    }
183
184
185
    /**
186
     * Create an array from this class
187
     *
188
     * @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...
189
     *   'ProviderID': string,
190
     *   'Name'?: string,
191
     *   'Loc'?: string,
192
     * }
193
     */
194
    public function toArray(): array
195
    {
196
        $data = [
197
            'ProviderID' => $this->getProviderID()->getValue(),
198
            'Name' => $this->getName()?->getValue(),
199
            'Loc' => $this->getLoc()?->getValue(),
200
        ];
201
202
        return array_filter($data);
203
    }
204
}
205