Issues (476)

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/Certificate/Key.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Certificate;
6
7
use ArrayAccess;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Certificate\Exception\InvalidKeyUsageException;
10
use SimpleSAML\SAML2\Exception\InvalidArgumentException;
11
12
use function array_key_exists;
13
use function is_string;
14
15
/**
16
 * Simple DTO wrapper for (X509) keys. Implements ArrayAccess
17
 * for easier backwards compatibility.
18
 */
19
class Key implements ArrayAccess
20
{
21
    // Possible key usages
22
    public const string USAGE_SIGNING = 'signing';
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 22 at column 24
Loading history...
23
24
    public const string USAGE_ENCRYPTION = 'encryption';
25
26
27
    /** @var array */
28
    protected array $keyData = [];
29
30
31
    /**
32
     * @param array $keyData
33
     */
34
    public function __construct(array $keyData)
35
    {
36
        // forcing usage of offsetSet
37
        foreach ($keyData as $property => $value) {
38
            $this->offsetSet($property, $value);
39
        }
40
    }
41
42
43
    /**
44
     * Whether or not the key is configured to be used for usage given
45
     *
46
     * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
47
     */
48
    public function canBeUsedFor(string $usage): bool
49
    {
50
        Assert::oneOf(
51
            $usage,
52
            [self::USAGE_ENCRYPTION, self::USAGE_SIGNING],
53
            'Invalid key usage given: "%s", usages "%2$s" allowed',
54
            InvalidKeyUsageException::class,
55
        );
56
57
        return isset($this->keyData[$usage]) && $this->keyData[$usage];
58
    }
59
60
61
    /**
62
     * @param mixed $offset
63
     *
64
     * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
65
     */
66
    public function offsetExists(mixed $offset): bool
67
    {
68
        if (!is_string($offset)) {
69
            throw InvalidArgumentException::invalidType('string', $offset);
70
        }
71
        return array_key_exists($offset, $this->keyData);
72
    }
73
74
75
    /**
76
     * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
77
     */
78
    public function offsetGet($offset): mixed
79
    {
80
        if (!is_string($offset)) {
81
            throw InvalidArgumentException::invalidType('string', $offset);
82
        }
83
        return $this->keyData[$offset];
84
    }
85
86
87
    /**
88
     * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
89
     */
90
    public function offsetSet(mixed $offset, mixed $value): void
91
    {
92
        if (!is_string($offset)) {
93
            throw InvalidArgumentException::invalidType('string', $offset);
94
        }
95
        $this->keyData[$offset] = $value;
96
    }
97
98
99
    /**
100
     * @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
101
     */
102
    public function offsetUnset(mixed $offset): void
103
    {
104
        if (!is_string($offset)) {
105
            throw InvalidArgumentException::invalidType('string', $offset);
106
        }
107
        unset($this->keyData[$offset]);
108
    }
109
}
110