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/Route.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
declare(strict_types=1);
4
5
namespace Patoui\Router;
6
7
use InvalidArgumentException;
8
use Prophecy\Exception\Doubler\MethodNotFoundException;
9
10
class Route implements Routable
11
{
12
    /** @var string */
13
    private string $httpVerb;
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...
14
15
    /** @var string */
16
    private string $path;
17
18
    /** @var string */
19
    private string $className;
20
21
    /** @var string */
22
    private string $classMethodName;
23
24
    /** @var array<mixed> */
25
    private array $parameters;
26
27
    public function __construct(
28
        string $httpVerb,
29
        string $path,
30
        string $className,
31
        string $classMethodName
32
    ) {
33
        if (! in_array($httpVerb, ['get', 'post'])) {
34
            throw new InvalidArgumentException(
35
                'Invalid http verb, must be: get or post'
36
            );
37
        }
38
39
        if (! class_exists($className) || ! method_exists($className, $classMethodName)) {
40
            throw new MethodNotFoundException(
41
                "Method '{$classMethodName}' not found on class '{$className}'",
42
                $className,
43
                $classMethodName
44
            );
45
        }
46
47
        $this->httpVerb = $httpVerb;
48
        $this->path = $path;
49
        $this->className = $className;
50
        $this->classMethodName = $classMethodName;
51
        $this->parameters = [];
52
    }
53
54
    public function getClassName(): string
55
    {
56
        return $this->className;
57
    }
58
59
    public function getClassMethodName(): string
60
    {
61
        return $this->classMethodName;
62
    }
63
64
    public function getHttpVerb(): string
65
    {
66
        return $this->httpVerb;
67
    }
68
69
    public function isHttpVerbAndPathAMatch(
70
        string $httpVerb,
71
        string $path
72
    ): bool {
73
        $pathParts = explode('/', $path);
74
        $routePathParts = explode('/', $this->getPath());
75
76
        foreach ($routePathParts as $key => $routePathPart) {
77
            $segmentParts = explode('|', trim($routePathPart, '{}'));
78
            $castToType = count($segmentParts) === 2 ? (string) $segmentParts[0] : null;
79
            $parameterName = count($segmentParts) === 2 ? $segmentParts[1] : $segmentParts[0];
80
            if (isset($pathParts[$key]) && preg_match('/{.+}/', $routePathPart)) {
81
                $parameterValue = $pathParts[$key];
82
                if ($castToType && Type::isValidType($castToType)) {
83
                    /** @var mixed $parameterValue */
84
                    $parameterValue = Type::cast($castToType, $parameterValue);
85
                }
86
                $this->parameters[$parameterName] = $parameterValue;
87
                /** @psalm-suppress MixedAssignment */
88
                $routePathParts[$key] = $parameterValue;
89
            }
90
        }
91
92
        $routePath = implode('/', $routePathParts);
93
94
        return strcasecmp($this->getHttpVerb(), $httpVerb) === 0 &&
95
            trim($routePath, '/') === trim($path, '/');
96
    }
97
98
    public function getPath(): string
99
    {
100
        return $this->path;
101
    }
102
103
    /**
104
     * @return array<mixed>
105
     */
106
    public function getParameters(): array
107
    {
108
        return $this->parameters;
109
    }
110
}
111