GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (12)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

lib/UCD/Database.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace UCD;
4
5
use UCD\Unicode\Character;
6
use UCD\Unicode\Character\Collection;
7
use UCD\Unicode\Character\Properties\General\Block;
8
use UCD\Unicode\Character\Properties\General\GeneralCategory;
9
use UCD\Unicode\Character\Properties\General\Script;
10
use UCD\Unicode\Character\Repository;
11
use UCD\Unicode\Character\Repository\CharacterNotFoundException;
12
use UCD\Unicode\Codepoint;
13
use UCD\Unicode\Codepoint\AggregatorRelay;
14
use UCD\Unicode\CodepointAssigned;
15
use UCD\Unicode\NonCharacter;
16
use UCD\Unicode\Surrogate;
17
18
use UCD\Exception\InvalidArgumentException;
19
use UCD\Exception\OutOfRangeException;
20
21
use UCD\Infrastructure\Repository\CharacterRepository\FileRepository\RangeFile\PHPRangeFileDirectory;
22
use UCD\Infrastructure\Repository\CharacterRepository\FileRepository\Serializer\PHPSerializer;
23
use UCD\Infrastructure\Repository\CharacterRepository\FileRepository;
24
25
class Database
26
{
27
    /**
28
     * @var Repository
29
     */
30
    private $sourceRepository;
31
32
    /**
33
     * @param Repository $sourceRepository
34
     */
35
    public function __construct(Repository $sourceRepository)
36
    {
37
        $this->sourceRepository = $sourceRepository;
38
    }
39
40
    /**
41
     * @return static
42
     */
43
    public static function fromDisk()
44
    {
45
        return new static(
46
            self::createFileRepository()
47
        );
48
    }
49
50
    /**
51
     * @param Codepoint $codepoint
52
     * @return CodepointAssigned
53
     * @throws CharacterNotFoundException
54
     * @throws InvalidArgumentException
55
     * @throws OutOfRangeException
56
     */
57
    public function getByCodepoint(Codepoint $codepoint)
58
    {
59
        return $this->sourceRepository
60
            ->getByCodepoint($codepoint);
61
    }
62
63
    /**
64
     * @param Codepoint\Collection $codepoints
65
     * @return Character\Collection|CodepointAssigned[]
66
     */
67
    public function getByCodepoints(Codepoint\Collection $codepoints)
68
    {
69
        return $this->sourceRepository
70
            ->getByCodepoints($codepoints);
71
    }
72
73
    /**
74
     * @param Codepoint $codepoint
75
     * @return Character
76
     * @throws CharacterNotFoundException
77
     */
78
    public function getCharacterByCodepoint(Codepoint $codepoint)
79
    {
80
        $assigned = $this->getByCodepoint($codepoint);
81
82
        if ($assigned instanceof Character) {
83
            return $assigned;
84
        }
85
86
        throw CharacterNotFoundException::withCodepoint($codepoint);
87
    }
88
89
    /**
90
     * @return Collection|CodepointAssigned[]
91
     */
92
    public function all()
93
    {
94
        return $this->sourceRepository
95
            ->getAll();
96
    }
97
98
    /**
99
     * @return Collection|Character[]
100
     */
101
    public function onlyCharacters()
102
    {
103
        return $this->all()
104
            ->getCharacters();
105
    }
106
107
    /**
108
     * @return Collection|NonCharacter[]
109
     */
110
    public function onlyNonCharacters()
111
    {
112
        return $this->all()
113
            ->getNonCharacters();
114
    }
115
116
    /**
117
     * @return Collection|Surrogate[]
118
     */
119
    public function onlySurrogates()
120
    {
121
        return $this->all()
122
            ->getSurrogates();
123
    }
124
125
    /**
126
     * @param Block $block
127
     * @throws Repository\BlockNotFoundException
128
     * @return Codepoint\Range\Collection
129
     */
130
    public function getCodepointsByBlock(Block $block)
131
    {
132
        return $this->sourceRepository
133
            ->getCodepointsByBlock($block);
134
    }
135
136
    /**
137
     * @param Block $block
138
     * @return Collection|CodepointAssigned[]
139
     */
140
    public function getByBlock(Block $block)
141
    {
142
        return $this->getByCodepointRanges(
143
            $this->getCodepointsByBlock($block)
144
        );
145
    }
146
147
    /**
148
     * @param GeneralCategory $category
149
     * @throws Repository\BlockNotFoundException
150
     * @return Codepoint\Range\Collection
151
     */
152
    public function getCodepointsByCategory(GeneralCategory $category)
153
    {
154
        return $this->sourceRepository
155
            ->getCodepointsByCategory($category);
156
    }
157
158
    /**
159
     * @param GeneralCategory $category
160
     * @return Collection|CodepointAssigned[]
161
     */
162
    public function getByCategory(GeneralCategory $category)
163
    {
164
        return $this->getByCodepointRanges(
165
            $this->getCodepointsByCategory($category)
166
        );
167
    }
168
169
    /**
170
     * @param Script $script
171
     * @throws Repository\BlockNotFoundException
172
     * @return Codepoint\Range\Collection
173
     */
174
    public function getCodepointsByScript(Script $script)
175
    {
176
        return $this->sourceRepository
177
            ->getCodepointsByScript($script);
178
    }
179
180
    /**
181
     * @param Script $script
182
     * @return Collection|CodepointAssigned[]
183
     */
184
    public function getByScript(Script $script)
185
    {
186
        return $this->getByCodepointRanges(
187
            $this->getCodepointsByScript($script)
188
        );
189
    }
190
191
    /**
192
     * @param Codepoint\Range\Collection $ranges
193
     * @return CodepointAssigned[]
194
     */
195
    private function getByCodepointRanges(Codepoint\Range\Collection $ranges)
196
    {
197
        return $this->getByCodepoints(
198
            $ranges->expand()
0 ignored issues
show
It seems like $ranges->expand() targeting UCD\Unicode\Codepoint\Range\Collection::expand() can also be of type array<integer,object<UCD\Unicode\Codepoint>>; however, UCD\Database::getByCodepoints() does only seem to accept object<UCD\Unicode\Codepoint\Collection>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
199
        );
200
    }
201
202
    /**
203
     * @return int
204
     */
205
    public function getSize()
206
    {
207
        return count($this->sourceRepository);
208
    }
209
210
    /**
211
     * @return Repository
212
     */
213
    private static function createFileRepository()
214
    {
215
        $dbPathInfo = new \SplFileInfo(sprintf('%s/../../resources/generated/ucd', __DIR__));
216
        $charactersDirectory = PHPRangeFileDirectory::fromPath($dbPathInfo);
217
        $propsPathInfo = new \SplFileInfo(sprintf('%s/../../resources/generated/props', __DIR__));
218
        $propertiesDirectory = FileRepository\PropertyFile\PHPPropertyFileDirectory::fromPath($propsPathInfo);
219
        $aggregators = new FileRepository\PropertyAggregators();
220
        $serializer = new PHPSerializer();
221
222
        return new FileRepository($charactersDirectory, $propertiesDirectory, $aggregators, $serializer);
223
    }
224
}