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/AbstractStatement.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\Utils;
11
use SimpleSAML\SAML2\XML\ExtensionPointInterface;
12
use SimpleSAML\SAML2\XML\ExtensionPointTrait;
13
use SimpleSAML\XML\Attribute as XMLAttribute;
14
use SimpleSAML\XML\Chunk;
15
use SimpleSAML\XML\SchemaValidatableElementInterface;
16
use SimpleSAML\XML\SchemaValidatableElementTrait;
17
use SimpleSAML\XMLSchema\Constants as C_XSI;
18
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
19
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
20
use SimpleSAML\XMLSchema\Type\QNameValue;
21
22
/**
23
 * Class implementing the <saml:Statement> extension point.
24
 *
25
 * @package simplesamlphp/saml2
26
 */
27
abstract class AbstractStatement extends AbstractStatementType implements
28
    ExtensionPointInterface,
29
    SchemaValidatableElementInterface
30
{
31
    use ExtensionPointTrait;
32
    use SchemaValidatableElementTrait;
33
34
35
    public const string LOCALNAME = 'Statement';
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 35 at column 24
Loading history...
36
37
38
    /**
39
     * Initialize a custom saml:Statement element.
40
     *
41
     * @param \SimpleSAML\XMLSchema\Type\QNameValue $type
42
     */
43
    protected function __construct(
44
        protected QNameValue $type,
45
    ) {
46
    }
47
48
49
    /**
50
     * @return \SimpleSAML\XMLSchema\Type\QNameValue
51
     */
52
    public function getXsiType(): QNameValue
53
    {
54
        return $this->type;
55
    }
56
57
58
    /**
59
     * Convert an XML element into a Statement.
60
     *
61
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
62
     *   if the qualified name of the supplied element is wrong
63
     */
64
    public static function fromXML(DOMElement $xml): static
65
    {
66
        Assert::same($xml->localName, 'Statement', InvalidDOMElementException::class);
67
        Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class);
68
        Assert::true(
69
            $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'),
70
            'Missing required xsi:type in <saml:Statement> element.',
71
            SchemaViolationException::class,
72
        );
73
74
        $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml);
75
76
        // now check if we have a handler registered for it
77
        $handler = Utils::getContainer()->getExtensionHandler($type);
78
        if ($handler === null) {
79
            // we don't have a handler, proceed with unknown statement
80
            return new UnknownStatement(new Chunk($xml), $type);
81
        }
82
83
        Assert::subclassOf(
84
            $handler,
85
            AbstractStatement::class,
86
            'Elements implementing Statement must extend \SimpleSAML\SAML2\XML\saml\AbstractStatement.',
87
        );
88
        return $handler::fromXML($xml);
89
    }
90
91
92
    /**
93
     * Convert this Statement to XML.
94
     */
95
    public function toXML(?DOMElement $parent = null): DOMElement
96
    {
97
        $e = $this->instantiateParentElement($parent);
98
        $e->setAttributeNS(
99
            'http://www.w3.org/2000/xmlns/',
100
            'xmlns:' . static::getXsiTypePrefix(),
101
            static::getXsiTypeNamespaceURI()->getValue(),
102
        );
103
104
        $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType());
105
        $type->toXML($e);
106
107
        return $e;
108
    }
109
}
110