Issues (284)

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