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/md/AttributeConsumingService.php (5 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\XML\Constants as C;
0 ignored issues
show
The type SimpleSAML\XML\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...
10
use SimpleSAML\XML\SchemaValidatableElementInterface;
11
use SimpleSAML\XML\SchemaValidatableElementTrait;
12
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
13
use SimpleSAML\XMLSchema\Exception\MissingElementException;
14
use SimpleSAML\XMLSchema\Type\BooleanValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\BooleanValue 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...
15
use SimpleSAML\XMLSchema\Type\UnsignedShortValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\UnsignedShortValue 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...
16
17
use function var_export;
18
19
/**
20
 * Class representing SAML 2 Metadata AttributeConsumingService element.
21
 *
22
 * @package simplesamlphp/saml2
23
 */
24
final class AttributeConsumingService extends AbstractMdElement implements SchemaValidatableElementInterface
0 ignored issues
show
The type SimpleSAML\SAML2\XML\md\AbstractMdElement 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...
25
{
26
    use IndexedElementTrait;
27
    use SchemaValidatableElementTrait;
28
29
30
    /**
31
     * AttributeConsumingService constructor.
32
     *
33
     * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index
34
     * @param \SimpleSAML\SAML2\XML\md\ServiceName[] $serviceName
35
     * @param \SimpleSAML\SAML2\XML\md\RequestedAttribute[] $requestedAttribute
36
     * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault
37
     * @param \SimpleSAML\SAML2\XML\md\ServiceDescription[] $serviceDescription
38
     */
39
    public function __construct(
40
        UnsignedShortValue $index,
41
        protected array $serviceName,
42
        protected array $requestedAttribute,
43
        ?BooleanValue $isDefault = null,
44
        protected array $serviceDescription = [],
45
    ) {
46
        Assert::maxCount($serviceName, C::UNBOUNDED_LIMIT);
47
        Assert::minCount(
48
            $serviceName,
49
            1,
50
            'Missing at least one ServiceName in AttributeConsumingService.',
51
            MissingElementException::class,
52
        );
53
        Assert::allIsInstanceOf(
54
            $serviceName,
55
            ServiceName::class,
56
            'Service names must be specified as ServiceName objects.',
57
        );
58
        Assert::maxCount($serviceDescription, C::UNBOUNDED_LIMIT);
59
        Assert::allIsInstanceOf(
60
            $serviceDescription,
61
            ServiceDescription::class,
62
            'Service descriptions must be specified as ServiceDescription objects.',
63
        );
64
        Assert::maxCount($requestedAttribute, C::UNBOUNDED_LIMIT);
65
        Assert::allIsInstanceOf(
66
            $requestedAttribute,
67
            RequestedAttribute::class,
0 ignored issues
show
The type SimpleSAML\SAML2\XML\md\RequestedAttribute 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...
68
            'Requested attributes must be specified as RequestedAttribute objects.',
69
        );
70
        Assert::minCount(
71
            $requestedAttribute,
72
            1,
73
            'Missing at least one RequestedAttribute in AttributeConsumingService.',
74
            MissingElementException::class,
75
        );
76
77
        $this->setIndex($index);
78
        $this->setIsDefault($isDefault);
79
    }
80
81
82
    /**
83
     * Get the localized names of this service.
84
     *
85
     * @return \SimpleSAML\SAML2\XML\md\ServiceName[]
86
     */
87
    public function getServiceName(): array
88
    {
89
        return $this->serviceName;
90
    }
91
92
93
    /**
94
     * Collect the value of the ServiceDescription-property
95
     *
96
     * @return \SimpleSAML\SAML2\XML\md\ServiceDescription[]
97
     */
98
    public function getServiceDescription(): array
99
    {
100
        return $this->serviceDescription;
101
    }
102
103
104
    /**
105
     * Collect the value of the RequestedAttribute-property
106
     *
107
     * @return \SimpleSAML\SAML2\XML\md\RequestedAttribute[]
108
     */
109
    public function getRequestedAttribute(): array
110
    {
111
        return $this->requestedAttribute;
112
    }
113
114
115
    /**
116
     * Initialize / parse an AttributeConsumingService.
117
     *
118
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
119
     *   if the qualified name of the supplied element is wrong
120
     * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException
121
     *   if one of the mandatory child-elements is missing
122
     */
123
    public static function fromXML(DOMElement $xml): static
124
    {
125
        Assert::same($xml->localName, 'AttributeConsumingService', InvalidDOMElementException::class);
126
        Assert::same($xml->namespaceURI, AttributeConsumingService::NS, InvalidDOMElementException::class);
127
128
        $names = ServiceName::getChildrenOfClass($xml);
129
        Assert::minCount(
130
            $names,
131
            1,
132
            'Missing at least one ServiceName in AttributeConsumingService.',
133
            MissingElementException::class,
134
        );
135
136
        $descriptions = ServiceDescription::getChildrenOfClass($xml);
137
138
        $requestedAttrs = RequestedAttribute::getChildrenOfClass($xml);
139
140
        return new static(
141
            self::getAttribute($xml, 'index', UnsignedShortValue::class),
142
            $names,
143
            $requestedAttrs,
144
            self::getOptionalAttribute($xml, 'isDefault', BooleanValue::class, null),
145
            $descriptions,
146
        );
147
    }
148
149
150
    /**
151
     * Convert to \DOMElement.
152
     */
153
    public function toXML(?DOMElement $parent = null): DOMElement
154
    {
155
        $e = $this->instantiateParentElement($parent);
156
        $e->setAttribute('index', $this->getIndex()->getValue());
157
158
        if ($this->getIsDefault() !== null) {
159
            $e->setAttribute('isDefault', var_export($this->getIsDefault()->toBoolean(), true));
160
        }
161
162
        foreach ($this->getServiceName() as $name) {
163
            $name->toXML($e);
164
        }
165
        foreach ($this->getServiceDescription() as $description) {
166
            $description->toXML($e);
167
        }
168
        foreach ($this->getRequestedAttribute() as $ra) {
169
            $ra->toXML($e);
170
        }
171
172
        return $e;
173
    }
174
}
175