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 (5)

Security Analysis    not enabled

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.

src/Uri.php (1 issue)

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
declare(strict_types=1);
4
5
namespace Patoui\Router;
6
7
use Psr\Http\Message\UriInterface;
8
9
class Uri implements UriInterface
10
{
11
    /** @var string */
12
    private string $scheme;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
13
14
    /** @var string */
15
    private string $host;
16
17
    /** @var int */
18
    private int $port;
19
20
    /** @var string */
21
    private string $user;
22
23
    /** @var string */
24
    private string $password;
25
26
    /** @var string */
27
    private string $path;
28
29
    /** @var string */
30
    private string $query;
31
32
    /** @var string */
33
    private string $fragment;
34
35
    public function __construct(string $uri)
36
    {
37
        $scheme = parse_url($uri, PHP_URL_SCHEME);
38
        $host = parse_url($uri, PHP_URL_HOST);
39
        $port = parse_url($uri, PHP_URL_PORT);
40
        $port = $port ? (int) $port : 80;
41
        $user = parse_url($uri, PHP_URL_USER);
42
        $password = parse_url($uri, PHP_URL_PASS);
43
        $path = parse_url($uri, PHP_URL_PATH);
44
        $query = parse_url($uri, PHP_URL_QUERY);
45
        $fragment = parse_url($uri, PHP_URL_FRAGMENT);
46
47
        $this->scheme = $scheme ?: '';
48
        $this->host = $host ?: '';
49
        $this->port = $port;
50
        $this->user = $user ?: '';
51
        $this->path = $path ?: '';
52
        $this->password = $password ?: '';
53
        $this->query = $query ?: '';
54
        $this->fragment = $fragment ?: '';
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getScheme()
61
    {
62
        return $this->scheme;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getAuthority()
69
    {
70
        $userInfo = $this->getUserInfo();
71
        $port = $this->getPort();
72
        $authority = ($userInfo !== '' ? $userInfo.'@' : '');
73
        $authority .= $this->getHost();
74
        $authority .= ($port !== null ? ':'.$port : '');
75
76
        return $authority;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getUserInfo()
83
    {
84
        if (! $this->user) {
85
            return '';
86
        }
87
88
        return $this->user.($this->password ? ":{$this->password}" : '');
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function getHost()
95
    {
96
        return $this->host;
97
    }
98
99
    /**
100
     * {@inheritdoc}
101
     */
102
    public function getPort()
103
    {
104
        return $this->port;
105
    }
106
107
    /**
108
     * {@inheritdoc}
109
     */
110
    public function getPath()
111
    {
112
        return $this->path;
113
    }
114
115
    /**
116
     * {@inheritdoc}
117
     */
118
    public function getQuery()
119
    {
120
        return $this->query;
121
    }
122
123
    /**
124
     * {@inheritdoc}
125
     */
126
    public function getFragment()
127
    {
128
        return $this->fragment;
129
    }
130
131
    /**
132
     * Return an instance with the specified scheme.
133
     *
134
     * This method MUST retain the state of the current instance, and return
135
     * an instance that contains the specified scheme.
136
     *
137
     * Implementations MUST support the schemes "http" and "https" case
138
     * insensitively, and MAY accommodate other schemes if required.
139
     *
140
     * An empty scheme is equivalent to removing the scheme.
141
     *
142
     * @param  string  $scheme  The scheme to use with the new instance.
143
     * @return static A new instance with the specified scheme.
144
     * @throws \InvalidArgumentException for invalid or unsupported schemes.
145
     */
146
    public function withScheme($scheme)
147
    {
148
        if (preg_match('/^[a-zA-Z0-9+-.]+$/', $scheme) === 0) {
149
            throw new \InvalidArgumentException(
150
                "Invalid scheme {$scheme}; please reference RFC3986 for additional details"
151
            );
152
        }
153
154
        $instance = clone $this;
155
        $instance->scheme = strtolower($scheme);
156
157
        return $instance;
158
    }
159
160
    /**
161
     * {@inheritdoc}
162
     */
163
    public function withUserInfo($user, $password = null)
164
    {
165
        $instance = clone $this;
166
        $instance->user = $user;
167
        if ($password) {
168
            $instance->password = $password;
169
        }
170
171
        return $instance;
172
    }
173
174
    /**
175
     * {@inheritdoc}
176
     */
177
    public function withHost($host)
178
    {
179
        /** @psalm-suppress DocblockTypeContradiction */
180
        if (! is_string($host)) {
181
            throw new \InvalidArgumentException("Invalid host: {$host}");
182
        }
183
184
        if (filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
185
            $host = "[{$host}]";
186
        }
187
188
        $instance = clone $this;
189
        $instance->host = $host;
190
191
        return $instance;
192
    }
193
194
    /**
195
     * {@inheritdoc}
196
     */
197
    public function withPort($port)
198
    {
199
        /** @psalm-suppress DocblockTypeContradiction */
200
        if (! is_int($port)) {
201
            throw new \InvalidArgumentException("Invalid port: {$port}");
202
        }
203
204
        $instance = clone $this;
205
        $instance->port = $port;
206
207
        return $instance;
208
    }
209
210
    /**
211
     * {@inheritdoc}
212
     */
213
    public function withPath($path)
214
    {
215
        /** @psalm-suppress DocblockTypeContradiction */
216
        if (! is_string($path)) {
217
            throw new \InvalidArgumentException("Invalid path: {$path}");
218
        }
219
220
        $instance = clone $this;
221
        $instance->path = $path;
222
223
        return $instance;
224
    }
225
226
    /**
227
     * {@inheritdoc}
228
     */
229
    public function withQuery($query)
230
    {
231
        /** @psalm-suppress DocblockTypeContradiction */
232
        if (! is_string($query)) {
233
            throw new \InvalidArgumentException("Invalid query: {$query}");
234
        }
235
236
        $instance = clone $this;
237
        $instance->query = ltrim($query, '?');
238
239
        return $instance;
240
    }
241
242
    /**
243
     * {@inheritdoc}
244
     */
245
    public function withFragment($fragment)
246
    {
247
        /** @psalm-suppress DocblockTypeContradiction */
248
        if (! is_string($fragment)) {
249
            throw new \InvalidArgumentException("Invalid fragment: {$fragment}");
250
        }
251
252
        $instance = clone $this;
253
        $instance->fragment = ltrim($fragment, '#');
254
255
        return $instance;
256
    }
257
258
    /**
259
     * {@inheritdoc}
260
     */
261
    public function __toString()
262
    {
263
        $scheme = $this->getScheme();
264
        $authority = $this->getAuthority();
265
        $path = $this->getPath();
266
        $query = $this->getQuery();
267
        $fragment = $this->getFragment();
268
        $uri = $scheme ? "{$scheme}:" : '';
269
        $uri .= $authority ? "//{$authority}" : '';
270
271
        if ($path) {
272
            if ($authority && strlen(ltrim($path, '/')) === 0) {
273
                $uri .= '/';
274
            } elseif (! $authority && strpos($path, '//') === 0) {
275
                $uri .= '/'.ltrim($path, '/');
276
            } else {
277
                $uri .= $path;
278
            }
279
        }
280
281
        $uri .= $query ? '?'.ltrim($query, '?') : '';
282
        $uri .= $fragment ? '#'.ltrim($fragment, '#') : '';
283
284
        return $uri;
285
    }
286
}
287