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