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/wsu/AbstractTimestamp.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wsu;
6
7
use DOMElement;
8
use SimpleSAML\WSSecurity\Assert\Assert;
9
use SimpleSAML\XML\Attribute as XMLAttribute;
10
use SimpleSAML\XML\Exception\InvalidDOMElementException;
11
use SimpleSAML\XML\ExtendableAttributesTrait;
12
use SimpleSAML\XML\ExtendableElementTrait;
13
use SimpleSAML\XML\XsNamespace as NS;
14
15
use function array_pop;
16
17
/**
18
 * Abstract class defining the Timestamp type
19
 *
20
 * @package simplesamlphp/ws-security
21
 */
22
abstract class AbstractTimestamp extends AbstractWsuElement
23
{
24
    use ExtendableAttributesTrait;
25
    use ExtendableElementTrait;
0 ignored issues
show
The trait SimpleSAML\XML\ExtendableElementTrait requires some properties which are not provided by SimpleSAML\WSSecurity\XML\wsu\AbstractTimestamp: $namespaceURI, $localName, $childNodes
Loading history...
26
27
    /** The namespace-attribute for the xs:anyAttribute element */
28
    public const XS_ANY_ATTR_NAMESPACE = NS::OTHER;
29
30
    /** The namespace-attribute for the xs:any element */
31
    public const XS_ANY_ELT_NAMESPACE = NS::ANY;
32
33
    /** The exclusions for the xs:any element */
34
    public const XS_ANY_ELT_EXCLUSIONS = [
35
        ['http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd', 'Created'],
36
        ['http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd', 'Expires'],
37
    ];
38
39
40
    /**
41
     * AbstractTimestamp constructor
42
     *
43
     * @param \SimpleSAML\WSSecurity\XML\wsu\Created|null $created
44
     * @param \SimpleSAML\WSSecurity\XML\wsu\Expires|null $expires
45
     * @param string|null $Id
46
     * @param array<\SimpleSAML\XML\SerializableElementInterface> $elements
47
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
48
     */
49
    final public function __construct(
50
        protected ?Created $created = null,
51
        protected ?Expires $expires = null,
52
        protected ?string $Id = null,
53
        array $elements = [],
54
        array $namespacedAttributes = [],
55
    ) {
56
        Assert::nullOrValidNCName($Id);
57
58
        $this->setElements($elements);
59
        $this->setAttributesNS($namespacedAttributes);
60
    }
61
62
63
    /**
64
     * @return string|null
65
     */
66
    public function getId(): ?string
67
    {
68
        return $this->Id;
69
    }
70
71
72
    /**
73
     * @return \SimpleSAML\WSSecurity\XML\wsu\Created|null
74
     */
75
    public function getCreated(): ?Created
76
    {
77
        return $this->created;
78
    }
79
80
81
    /**
82
     * @return \SimpleSAML\WSSecurity\XML\wsu\Expires|null
83
     */
84
    public function getExpires(): ?Expires
85
    {
86
        return $this->expires;
87
    }
88
89
90
    /**
91
     * Test if an object, at the state it's in, would produce an empty XML-element
92
     *
93
     * @return bool
94
     */
95
    public function isEmptyElement(): bool
96
    {
97
        return empty($this->getCreated())
98
            && empty($this->getExpires())
99
            && empty($this->getId())
100
            && empty($this->getElements())
101
            && empty($this->getAttributesNS());
102
    }
103
104
105
    /**
106
     * Create an instance of this object from its XML representation.
107
     *
108
     * @param \DOMElement $xml
109
     * @return static
110
     *
111
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
112
     *   if the qualified name of the supplied element is wrong
113
     */
114
    public static function fromXML(DOMElement $xml): static
115
    {
116
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
117
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
118
119
        $created = Created::getChildrenOfClass($xml);
120
        $expires = Expires::getChildrenOfClass($xml);
121
        $children = self::getChildElementsFromXML($xml);
122
123
        $Id = null;
124
        if ($xml->hasAttributeNS(static::NS, 'Id')) {
125
            $Id = $xml->getAttributeNS(static::NS, 'Id');
126
        }
127
128
        return new static(
129
            array_pop($created),
130
            array_pop($expires),
131
            $Id,
132
            $children,
133
            self::getAttributesNSFromXML($xml),
134
        );
135
    }
136
137
138
    /**
139
     * Convert this Timestamp to XML.
140
     *
141
     * @param \DOMElement|null $parent The element we should append this class to.
142
     * @return \DOMElement The XML element after adding the data corresponding to this Timestamp.
143
     */
144
    public function toXML(?DOMElement $parent = null): DOMElement
145
    {
146
        $e = $this->instantiateParentElement($parent);
147
148
        $attributes = $this->getAttributesNS();
149
        if ($this->getId() !== null) {
150
            $attributes[] = new XMLAttribute(static::NS, 'wsu', 'Id', $this->getId());
151
        }
152
153
        foreach ($attributes as $attr) {
154
            $attr->toXML($e);
155
        }
156
157
        $this->getCreated()?->toXML($e);
158
        $this->getExpires()?->toXML($e);
159
160
        foreach ($this->getElements() as $detail) {
161
            /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $detail */
162
            $detail->toXML($e);
163
        }
164
165
        return $e;
166
    }
167
}
168