Issues (85)

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/AbstractLocalizedName.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\Assert\Assert;
9
use SimpleSAML\SAML2\Exception\ArrayValidationException;
10
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
11
use SimpleSAML\SAML2\XML\StringElementTrait;
12
use SimpleSAML\XML\ArrayizableElementInterface;
13
use SimpleSAML\XML\Constants as C;
14
use SimpleSAML\XML\Exception\InvalidDOMElementException;
15
use SimpleSAML\XML\Exception\MissingAttributeException;
16
17
use function array_key_first;
18
19
/**
20
 * Abstract class implementing LocalizedNameType.
21
 *
22
 * @package simplesamlphp/saml2
23
 */
24
abstract class AbstractLocalizedName extends AbstractMdElement implements ArrayizableElementInterface
25
{
26
    use StringElementTrait;
0 ignored issues
show
The trait SimpleSAML\SAML2\XML\StringElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\md\AbstractLocalizedName: $localName, $namespaceURI
Loading history...
27
28
29
    /**
30
     * LocalizedNameType constructor.
31
     *
32
     * @param string $language The language this string is localized in.
33
     * @param string $value The localized string.
34
     */
35
    final public function __construct(
36
        protected string $language,
37
        string $value,
38
    ) {
39
        Assert::notWhitespaceOnly($language, ProtocolViolationException::class);
40
41
        $this->setContent($value);
42
    }
43
44
45
    /**
46
     * Get the language this string is localized in.
47
     *
48
     * @return string
49
     */
50
    public function getLanguage(): string
51
    {
52
        return $this->language;
53
    }
54
55
56
    /**
57
     * Create an instance of this object from its XML representation.
58
     *
59
     * @param \DOMElement $xml
60
     * @return static
61
     *
62
     * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
63
     *   if the qualified name of the supplied element is wrong
64
     */
65
    public static function fromXML(DOMElement $xml): static
66
    {
67
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
68
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
69
        Assert::true(
70
            $xml->hasAttributeNS(C::NS_XML, 'lang'),
71
            'Missing xml:lang from ' . static::getLocalName(),
72
            MissingAttributeException::class,
73
        );
74
75
        return new static($xml->getAttributeNS(C::NS_XML, 'lang'), $xml->textContent);
76
    }
77
78
79
    /**
80
     * @param \DOMElement|null $parent
81
     * @return \DOMElement
82
     */
83
    final public function toXML(?DOMElement $parent = null): DOMElement
84
    {
85
        $e = $this->instantiateParentElement($parent);
86
        $e->setAttributeNS(C::NS_XML, 'xml:lang', $this->getLanguage());
87
        $e->textContent = $this->getContent();
88
89
        return $e;
90
    }
91
92
93
    /**
94
     * Create a class from an array
95
     *
96
     * @param array $data
97
     * @return static
98
     */
99
    public static function fromArray(array $data): static
100
    {
101
        Assert::count($data, 1, ArrayValidationException::class);
102
103
        $lang = array_key_first($data);
104
        Assert::stringNotEmpty($lang, ArrayValidationException::class);
105
106
        $value = $data[$lang];
107
        Assert::stringNotEmpty($value, ArrayValidationException::class);
108
109
        return new static($lang, $value);
110
    }
111
112
113
    /**
114
     * Create an array from this class
115
     *
116
     * @return array
117
     */
118
    public function toArray(): array
119
    {
120
        return [$this->language => $this->getContent()];
121
    }
122
}
123