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/Advice.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\XML\ExtendableElementTrait;
11
use SimpleSAML\XML\SchemaValidatableElementInterface;
12
use SimpleSAML\XML\SchemaValidatableElementTrait;
13
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
14
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
15
use SimpleSAML\XMLSchema\XML\Constants\NS;
16
17
/**
18
 * Class representing a saml:Advice element.
19
 *
20
 * @package simplesaml/saml2
21
 */
22
final class Advice extends AbstractSamlElement implements SchemaValidatableElementInterface
23
{
24
    use ExtendableElementTrait;
25
    use SchemaValidatableElementTrait;
26
27
28
    /** The namespace-attribute for the xs:any element */
29
    public const string XS_ANY_ELT_NAMESPACE = NS::OTHER;
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 29 at column 24
Loading history...
30
31
32
    /**
33
     * @param \SimpleSAML\SAML2\XML\saml\AssertionIDRef[] $assertionIDRef
34
     * @param \SimpleSAML\SAML2\XML\saml\AssertionURIRef[] $assertionURIRef
35
     * @param \SimpleSAML\SAML2\XML\saml\Assertion[] $assertion
36
     * @param \SimpleSAML\SAML2\XML\saml\EncryptedAssertion[] $encryptedAssertion
37
     * @param \SimpleSAML\XML\SerializableElementInterface[] $elements
38
     */
39
    public function __construct(
40
        protected array $assertionIDRef = [],
41
        protected array $assertionURIRef = [],
42
        protected array $assertion = [],
43
        protected array $encryptedAssertion = [],
44
        array $elements = [],
45
    ) {
46
        Assert::maxCount($assertionIDRef, C::UNBOUNDED_LIMIT);
47
        Assert::maxCount($assertionURIRef, C::UNBOUNDED_LIMIT);
48
        Assert::maxCount($assertion, C::UNBOUNDED_LIMIT);
49
        Assert::maxCount($encryptedAssertion, C::UNBOUNDED_LIMIT);
50
        Assert::allIsInstanceOf($assertionIDRef, AssertionIDRef::class, SchemaViolationException::class);
51
        Assert::allIsInstanceOf($assertionURIRef, AssertionURIRef::class, SchemaViolationException::class);
52
        Assert::allIsInstanceOf($assertion, Assertion::class, SchemaViolationException::class);
53
        Assert::allIsInstanceOf($encryptedAssertion, EncryptedAssertion::class, SchemaViolationException::class);
54
55
        $this->setElements($elements);
56
    }
57
58
59
    /**
60
     * Test if an object, at the state it's in, would produce an empty XML-element
61
     */
62
    public function isEmptyElement(): bool
63
    {
64
        return empty($this->assertionIDRef)
65
            && empty($this->assertionURIRef)
66
            && empty($this->assertion)
67
            && empty($this->encryptedAssertion)
68
            && empty($this->getElements());
69
    }
70
71
72
    /**
73
     * @return \SimpleSAML\SAML2\XML\saml\AssertionIDRef[]
74
     */
75
    public function getAssertionIDRef(): array
76
    {
77
        return $this->assertionIDRef;
78
    }
79
80
81
    /**
82
     * @return \SimpleSAML\SAML2\XML\saml\AssertionURIRef[]
83
     */
84
    public function getAssertionURIRef(): array
85
    {
86
        return $this->assertionURIRef;
87
    }
88
89
90
    /**
91
     * @return \SimpleSAML\SAML2\XML\saml\Assertion[]
92
     */
93
    public function getAssertion(): array
94
    {
95
        return $this->assertion;
96
    }
97
98
99
    /**
100
     * @return \SimpleSAML\SAML2\XML\saml\EncryptedAssertion[]
101
     */
102
    public function getEncryptedAssertion(): array
103
    {
104
        return $this->encryptedAssertion;
105
    }
106
107
108
    /**
109
     * Convert XML into an Advice
110
     *
111
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
112
     *   If the qualified name of the supplied element is wrong
113
     */
114
    public static function fromXML(DOMElement $xml): static
115
    {
116
        $qualifiedName = static::getClassName(static::class);
117
        Assert::eq(
118
            $xml->localName,
119
            $qualifiedName,
120
            'Unexpected name for endpoint: ' . $xml->localName . '. Expected: ' . $qualifiedName . '.',
121
            InvalidDOMElementException::class,
122
        );
123
124
        $assertionIDRef = AssertionIDRef::getChildrenOfClass($xml);
125
        $assertionURIRef = AssertionURIRef::getChildrenOfClass($xml);
126
        $assertion = Assertion::getChildrenOfClass($xml);
127
        $encryptedAssertion = EncryptedAssertion::getChildrenOfClass($xml);
128
129
        return new static(
130
            $assertionIDRef,
131
            $assertionURIRef,
132
            $assertion,
133
            $encryptedAssertion,
134
            self::getChildElementsFromXML($xml),
135
        );
136
    }
137
138
139
    /**
140
     * Convert this Advince to XML.
141
     */
142
    public function toXML(?DOMElement $parent = null): DOMElement
143
    {
144
        $e = $this->instantiateParentElement($parent);
145
146
        foreach ($this->getAssertionIDRef() as $assertionIDRef) {
147
            $assertionIDRef->toXML($e);
148
        }
149
150
        foreach ($this->getAssertionURIRef() as $assertionURIRef) {
151
            $assertionURIRef->toXML($e);
152
        }
153
154
        foreach ($this->getAssertion() as $assertion) {
155
            $assertion->toXML($e);
156
        }
157
158
        foreach ($this->getEncryptedAssertion() as $encryptedAssertion) {
159
            $encryptedAssertion->toXML($e);
160
        }
161
162
        foreach ($this->getElements() as $element) {
163
            $element->toXML($e);
164
        }
165
166
        return $e;
167
    }
168
}
169