Issues (99)

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/md/AbstractMetadataDocument.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
10
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
11
use SimpleSAML\SAML2\XML\ExtendableElementTrait;
12
use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo;
13
use SimpleSAML\SAML2\XML\mdrpi\PublicationPath;
14
use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo;
15
use SimpleSAML\SAML2\XML\mdui\DiscoHints;
16
use SimpleSAML\SAML2\XML\mdui\UIInfo;
17
use SimpleSAML\XMLSchema\Type\DurationValue;
18
use SimpleSAML\XMLSchema\Type\IDValue;
19
20
/**
21
 * Class to represent a metadata document
22
 *
23
 * @package simplesamlphp/saml2
24
 */
25
abstract class AbstractMetadataDocument extends AbstractSignedMdElement
26
{
27
    use ExtendableElementTrait;
28
29
30
    /**
31
     * Generic constructor for SAML metadata documents.
32
     *
33
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id The ID for this document. Defaults to null.
34
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document.
35
     *   Defaults to null.
36
     * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached.
37
     *   Defaults to null.
38
     * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to null.
39
     */
40
    public function __construct(
41
        protected ?IDValue $id = null,
42
        protected ?SAMLDateTimeValue $validUntil = null,
43
        protected ?DurationValue $cacheDuration = null,
44
        ?Extensions $extensions = null,
45
    ) {
46
        if ($extensions !== null) {
47
            $exts = $extensions->getList();
48
49
            /**
50
             * MDUI 2.1: this element MUST NOT appear more than once within a given <md:Extensions> element.
51
             */
52
            $uiInfo = array_values(array_filter($exts, function ($ext) {
53
                return $ext instanceof UIInfo;
54
            }));
55
            Assert::maxCount($uiInfo, 1, ProtocolViolationException::class);
56
57
            /**
58
             * MDUI 2.2: this element MUST NOT appear more than once within a given <md:Extensions> element.
59
             */
60
            $discoHints = array_values(array_filter($exts, function ($ext) {
61
                return $ext instanceof DiscoHints;
62
            }));
63
            Assert::maxCount($discoHints, 1, ProtocolViolationException::class);
64
65
            /**
66
             * MDRPI 2.1: this element MUST NOT appear more than once within a given <md:Extensions> element.
67
             */
68
            $regInfo = array_values(array_filter($exts, function ($ext) {
69
                return $ext instanceof RegistrationInfo;
70
            }));
71
            Assert::maxCount($regInfo, 1, ProtocolViolationException::class);
72
73
            /**
74
             * MDRPI 2.2: this element MUST NOT appear more than once within a given <md:Extensions> element.
75
             */
76
            $pubInfo = array_values(array_filter($exts, function ($ext) {
0 ignored issues
show
The assignment to $pubInfo is dead and can be removed.
Loading history...
77
                return $ext instanceof PublicationInfo;
78
            }));
79
            Assert::maxCount($regInfo, 1, ProtocolViolationException::class);
80
81
            /**
82
             * MDRPI 2.3: The <mdrpi:PublicationPath> element MUST NOT appear more than once within the
83
             * <md:Extensions> element of a given <md:EntitiesDescriptor> or <md:EntityDescriptor> element.
84
             */
85
            $pubPath = array_values(array_filter($exts, function ($ext) {
86
                return $ext instanceof PublicationPath;
87
            }));
88
            Assert::maxCount($pubPath, 1, ProtocolViolationException::class);
89
        }
90
91
        $this->setExtensions($extensions);
92
    }
93
94
95
    /**
96
     * Collect the value of the id property.
97
     *
98
     * @return \SimpleSAML\XMLSchema\Type\IDValue|null
99
     */
100
    public function getId(): ?IDValue
101
    {
102
        return $this->id;
103
    }
104
105
106
    /**
107
     * Collect the value of the validUntil property.
108
     *
109
     * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null
110
     */
111
    public function getValidUntil(): ?SAMLDateTimeValue
112
    {
113
        return $this->validUntil;
114
    }
115
116
117
    /**
118
     * Collect the value of the cacheDuration property.
119
     *
120
     * @return \SimpleSAML\XMLSchema\Type\DurationValue|null
121
     */
122
    public function getCacheDuration(): ?DurationValue
123
    {
124
        return $this->cacheDuration;
125
    }
126
127
128
    /**
129
     * @return \DOMElement
130
     */
131
    protected function getOriginalXML(): DOMElement
132
    {
133
        return $this->isSigned() ? $this->getXML() : $this->toUnsignedXML();
134
    }
135
136
137
    /**
138
     * @param \DOMElement|null $parent
139
     *
140
     * @return \DOMElement
141
     */
142
    public function toUnsignedXML(?DOMElement $parent = null): DOMElement
143
    {
144
        $e = $this->instantiateParentElement($parent);
145
146
        if ($this->getId() !== null) {
147
            $e->setAttribute('ID', $this->getId()->getValue());
148
        }
149
150
        if ($this->getValidUntil() !== null) {
151
            $e->setAttribute('validUntil', $this->getValidUntil()->getValue());
152
        }
153
154
        if ($this->getCacheDuration() !== null) {
155
            $e->setAttribute('cacheDuration', $this->getCacheDuration()->getValue());
156
        }
157
158
        $extensions = $this->getExtensions();
159
        if ($extensions !== null && !$extensions->isEmptyElement()) {
160
            $extensions->toXML($e);
161
        }
162
163
        return $e;
164
    }
165
}
166