Issues (581)

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/wsx/MetadataSection.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wsx;
6
7
use DOMElement;
8
use SimpleSAML\WSSecurity\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
use SimpleSAML\XML\Exception\MissingElementException;
11
use SimpleSAML\XML\Exception\TooManyElementsException;
12
use SimpleSAML\XML\ExtendableAttributesTrait;
13
use SimpleSAML\XML\ExtendableElementTrait;
14
use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait};
15
use SimpleSAML\XML\SerializableElementInterface;
16
use SimpleSAML\XML\XsNamespace as NS;
17
18
use function array_merge;
19
use function array_pop;
20
21
/**
22
 * Class defining the MetadataSection element
23
 *
24
 * @package simplesamlphp/ws-security
25
 */
26
final class MetadataSection extends AbstractWsxElement implements SchemaValidatableElementInterface
27
{
28
    use ExtendableAttributesTrait;
29
    use ExtendableElementTrait;
0 ignored issues
show
The trait SimpleSAML\XML\ExtendableElementTrait requires some properties which are not provided by SimpleSAML\WSSecurity\XML\wsx\MetadataSection: $namespaceURI, $localName, $childNodes
Loading history...
30
    use SchemaValidatableElementTrait;
0 ignored issues
show
The trait SimpleSAML\XML\SchemaValidatableElementTrait requires some properties which are not provided by SimpleSAML\WSSecurity\XML\wsx\MetadataSection: $message, $line
Loading history...
31
32
    /** The namespace-attribute for the xs:anyAttribute element */
33
    public const XS_ANY_ATTR_NAMESPACE = NS::OTHER;
34
35
    /** The namespace-attribute for the xs:any element */
36
    public const XS_ANY_ELT_NAMESPACE = NS::OTHER;
37
38
39
    /**
40
     * MetadataSection constructor
41
     *
42
     * @param (\SimpleSAML\XML\SerializableElementInterface|
43
     *         \SimpleSAML\WSSecurity\XML\wsx\MetadataReference|
44
     *         \SimpleSAML\WSSecurity\XML\wsx\Location) $child
45
     * @param string $Dialect
46
     * @param string|null $Identifier
47
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
48
     */
49
    final public function __construct(
50
        protected SerializableElementInterface|MetadataReference|Location $child,
51
        protected string $Dialect,
52
        protected ?string $Identifier = null,
53
        array $namespacedAttributes = [],
54
    ) {
55
        if (!($child instanceof MetadataReference) && !($child instanceof Location)) {
56
            Assert::notSame($child->toXML()->namespaceURI, static::NS);
57
        }
58
        Assert::validURI($Dialect);
59
        Assert::nullOrValidURI($Identifier);
60
61
        $this->setAttributesNS($namespacedAttributes);
62
    }
63
64
65
    /**
66
     * Get the child property.
67
     *
68
     * @return (\SimpleSAML\XML\SerializableElementInterface|
0 ignored issues
show
Documentation Bug introduced by
The doc comment (\SimpleSAML\XML\SerializableElementInterface| at position 3 could not be parsed: the token is null at position 3.
Loading history...
69
     *         \SimpleSAML\WSSecurity\XML\wsx\MetadataReference|
70
     *         \SimpleSAML\WSSecurity\XML\wsx\Location)
71
     */
72
    public function getChild(): SerializableElementInterface|MetadataReference|Location
73
    {
74
        return $this->child;
75
    }
76
77
78
    /**
79
     * Get the Dialect property.
80
     *
81
     * @return string
82
     */
83
    public function getDialect(): string
84
    {
85
        return $this->Dialect;
86
    }
87
88
89
    /**
90
     * Get the Identifier property.
91
     *
92
     * @return string|null
93
     */
94
    public function getIdentifier(): ?string
95
    {
96
        return $this->Identifier;
97
    }
98
99
100
    /**
101
     * Create an instance of this object from its XML representation.
102
     *
103
     * @param \DOMElement $xml
104
     * @return static
105
     *
106
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
107
     *   if the qualified name of the supplied element is wrong
108
     */
109
    public static function fromXML(DOMElement $xml): static
110
    {
111
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
112
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
113
114
        $children = self::getChildElementsFromXML($xml);
115
        $metadataReference = MetadataReference::getChildrenOfClass($xml);
116
        $location = Location::getChildrenOfClass($xml);
117
118
        $children = array_merge($children, $metadataReference, $location);
119
        Assert::minCount($children, 1, MissingElementException::class);
120
        Assert::maxCount($children, 1, TooManyElementsException::class);
121
122
        return new static(
123
            array_pop($children),
124
            self::getAttribute($xml, 'Dialect'),
125
            self::getOptionalAttribute($xml, 'Identifier', null),
126
            self::getAttributesNSFromXML($xml),
127
        );
128
    }
129
130
131
    /**
132
     * Add this MetadataSection to an XML element.
133
     *
134
     * @param \DOMElement|null $parent The element we should append this MetadataSection to.
135
     * @return \DOMElement
136
     */
137
    public function toXML(?DOMElement $parent = null): DOMElement
138
    {
139
        $e = parent::instantiateParentElement($parent);
140
        $e->setAttribute('Dialect', $this->getDialect());
141
142
        if ($this->getIdentifier() !== null) {
143
            $e->setAttribute('Identifier', $this->getIdentifier());
144
        }
145
146
        $this->getChild()->toXML($e);
147
148
        foreach ($this->getAttributesNS() as $attr) {
149
            $attr->toXML($e);
150
        }
151
152
        return $e;
153
    }
154
}
155