Issues (538)

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/saml/AbstractBaseID.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Constants as C;
10
use SimpleSAML\SAML2\Type\SAMLStringValue;
11
use SimpleSAML\SAML2\Utils;
12
use SimpleSAML\SAML2\XML\EncryptableElementTrait;
13
use SimpleSAML\SAML2\XML\ExtensionPointInterface;
14
use SimpleSAML\SAML2\XML\ExtensionPointTrait;
15
use SimpleSAML\XML\Attribute as XMLAttribute;
16
use SimpleSAML\XML\Chunk;
17
use SimpleSAML\XML\SchemaValidatableElementInterface;
18
use SimpleSAML\XML\SchemaValidatableElementTrait;
19
use SimpleSAML\XMLSchema\Constants as C_XSI;
20
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
21
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
22
use SimpleSAML\XMLSchema\Type\QNameValue;
23
use SimpleSAML\XMLSecurity\Backend\EncryptionBackend;
24
use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface;
25
26
/**
27
 * SAML BaseID data type.
28
 *
29
 * @package simplesamlphp/saml2
30
 */
31
abstract class AbstractBaseID extends AbstractBaseIDType implements
32
    EncryptableElementInterface,
33
    ExtensionPointInterface,
34
    SchemaValidatableElementInterface
35
{
36
    use EncryptableElementTrait;
37
    use ExtensionPointTrait;
38
    use SchemaValidatableElementTrait;
39
40
41
    public const string LOCALNAME = 'BaseID';
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 41 at column 24
Loading history...
42
43
44
    /**
45
     * Initialize a saml:BaseID from scratch
46
     *
47
     * @param \SimpleSAML\XMLSchema\Type\QNameValue $type
48
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier
49
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier
50
     */
51
    protected function __construct(
52
        protected QNameValue $type,
53
        ?SAMLStringValue $NameQualifier = null,
54
        ?SAMLStringValue $SPNameQualifier = null,
55
    ) {
56
        parent::__construct($NameQualifier, $SPNameQualifier);
57
    }
58
59
60
    /**
61
     * @return \SimpleSAML\XMLSchema\Type\QNameValue
62
     */
63
    public function getXsiType(): QNameValue
64
    {
65
        return $this->type;
66
    }
67
68
69
    /**
70
     * Convert XML into an BaseID
71
     *
72
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
73
     *   if the qualified name of the supplied element is wrong
74
     */
75
    public static function fromXML(DOMElement $xml): static
76
    {
77
        Assert::same($xml->localName, 'BaseID', InvalidDOMElementException::class);
78
        Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class);
79
        Assert::true(
80
            $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'),
81
            'Missing required xsi:type in <saml:BaseID> element.',
82
            SchemaViolationException::class,
83
        );
84
85
        $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml);
86
87
        // now check if we have a handler registered for it
88
        $handler = Utils::getContainer()->getExtensionHandler($type);
89
        if ($handler === null) {
90
            // we don't have a handler, proceed with unknown identifier
91
            return new UnknownID(
92
                new Chunk($xml),
93
                $type,
94
                self::getOptionalAttribute($xml, 'NameQualifier', SAMLStringValue::class, null),
95
                self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null),
96
            );
97
        }
98
99
        Assert::subclassOf(
100
            $handler,
101
            AbstractBaseID::class,
102
            'Elements implementing BaseID must extend \SimpleSAML\SAML2\XML\saml\AbstractBaseID.',
103
        );
104
        return $handler::fromXML($xml);
105
    }
106
107
108
    /**
109
     * Convert this BaseID to XML.
110
     */
111
    public function toXML(?DOMElement $parent = null): DOMElement
112
    {
113
        $e = parent::toXML($parent);
114
        $e->setAttributeNS(
115
            'http://www.w3.org/2000/xmlns/',
116
            'xmlns:' . static::getXsiTypePrefix(),
117
            static::getXsiTypeNamespaceURI()->getValue(),
118
        );
119
120
        $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType());
121
        $type->toXML($e);
122
123
        if ($this->getNameQualifier() !== null) {
124
            $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue());
125
        }
126
127
        if ($this->getSPNameQualifier() !== null) {
128
            $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue());
129
        }
130
131
        return $e;
132
    }
133
134
135
    /**
136
     * @return \SimpleSAML\XMLSecurity\Backend\EncryptionBackend|null
137
     */
138
    public function getEncryptionBackend(): ?EncryptionBackend
139
    {
140
        // return the encryption backend you want to use,
141
        // or null if you are fine with the default
142
        return null;
143
    }
144
}
145