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/ecp/SubjectConfirmation.php (3 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\ecp;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
10
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
11
use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData;
12
use SimpleSAML\SOAP11\Constants as C;
0 ignored issues
show
The type SimpleSAML\SOAP11\Constants was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use SimpleSAML\SOAP11\Type\MustUnderstandValue;
0 ignored issues
show
The type SimpleSAML\SOAP11\Type\MustUnderstandValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use SimpleSAML\XML\SchemaValidatableElementInterface;
15
use SimpleSAML\XML\SchemaValidatableElementTrait;
16
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
17
use SimpleSAML\XMLSchema\Exception\MissingAttributeException;
18
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
19
20
/**
21
 * Class representing the ECP SubjectConfirmation element.
22
 *
23
 * @package simplesamlphp/saml2
24
 */
25
final class SubjectConfirmation extends AbstractEcpElement implements SchemaValidatableElementInterface
0 ignored issues
show
The type SimpleSAML\SAML2\XML\ecp\AbstractEcpElement was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
{
27
    use SchemaValidatableElementTrait;
28
29
30
    /**
31
     * Create a ECP SubjectConfirmation element.
32
     *
33
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $method
34
     * @param \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null $subjectConfirmationData
35
     */
36
    public function __construct(
37
        protected SAMLAnyURIValue $method,
38
        protected ?SubjectConfirmationData $subjectConfirmationData = null,
39
    ) {
40
    }
41
42
43
    /**
44
     * Collect the value of the method-property
45
     *
46
     * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue
47
     */
48
    public function getMethod(): SAMLAnyURIValue
49
    {
50
        return $this->method;
51
    }
52
53
54
    /**
55
     * Collect the value of the subjectConfirmationData-property
56
     *
57
     * @return \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null
58
     */
59
    public function getSubjectConfirmationData(): ?SubjectConfirmationData
60
    {
61
        return $this->subjectConfirmationData;
62
    }
63
64
65
    /**
66
     * Convert XML into a SubjectConfirmation
67
     *
68
     * @param \DOMElement $xml The XML element we should load
69
     *
70
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
71
     *   if the qualified name of the supplied element is wrong
72
     * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException
73
     *   if the supplied element is missing any of the mandatory attributes
74
     */
75
    public static function fromXML(DOMElement $xml): static
76
    {
77
        Assert::same($xml->localName, 'SubjectConfirmation', InvalidDOMElementException::class);
78
        Assert::same($xml->namespaceURI, SubjectConfirmation::NS, InvalidDOMElementException::class);
79
80
        // Assert required attributes
81
        Assert::true(
82
            $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'),
83
            'Missing env:actor attribute in <ecp:SubjectConfirmation>.',
84
            MissingAttributeException::class,
85
        );
86
        Assert::true(
87
            $xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'),
88
            'Missing env:mustUnderstand attribute in <ecp:SubjectConfirmation>.',
89
            MissingAttributeException::class,
90
        );
91
92
        $mustUnderstand = MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'));
93
        Assert::true(
94
            $mustUnderstand->toBoolean(),
95
            'Invalid value of env:mustUnderstand attribute in <ecp:SubjectConfirmation>.',
96
            ProtocolViolationException::class,
97
        );
98
99
        Assert::same(
100
            $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'),
101
            C::SOAP_ACTOR_NEXT,
102
            'Invalid value of env:actor attribute in <ecp:SubjectConfirmation>.',
103
            ProtocolViolationException::class,
104
        );
105
106
        $subjectConfirmationData = SubjectConfirmationData::getChildrenOfClass($xml);
107
        Assert::maxCount(
108
            $subjectConfirmationData,
109
            1,
110
            'More than one <saml:SubjectConfirmationData> in <saml:SubjectConfirmation>.',
111
            TooManyElementsException::class,
112
        );
113
114
        return new static(
115
            self::getAttribute($xml, 'Method', SAMLAnyURIValue::class),
116
            array_pop($subjectConfirmationData),
117
        );
118
    }
119
120
121
    /**
122
     * Convert this ECP SubjectConfirmation to XML.
123
     *
124
     * @param \DOMElement|null $parent The element we should append this element to.
125
     */
126
    public function toXML(?DOMElement $parent = null): DOMElement
127
    {
128
        $e = $this->instantiateParentElement($parent);
129
        $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1');
130
        $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT);
131
        $e->setAttribute('Method', $this->getMethod()->getValue());
132
133
        $this->getSubjectConfirmationData()?->toXML($e);
134
135
        return $e;
136
    }
137
}
138