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

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.

src/Filesystem.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 declare(strict_types=1);
2
3
namespace WyriHaximus\React\Cache;
4
5
use React\Cache\CacheInterface;
6
use React\Filesystem\FilesystemInterface as ReactFilesystem;
7
use React\Filesystem\Node\FileInterface;
8
use React\Filesystem\Node\NodeInterface;
9
use function React\Promise\all;
10
use React\Promise\Promise;
11
use React\Promise\PromiseInterface;
12
use function React\Promise\reject;
13
use function React\Promise\resolve;
14
use Throwable;
15
16
final class Filesystem implements CacheInterface
17
{
18
    /**
19
     * @var ReactFilesystem
20
     */
21
    private $filesystem;
22
23
    /**
24
     * @var string
25
     */
26
    private $path;
27
28
    /**
29
     * filesystem constructor.
30
     * @param ReactFilesystem $filesystem
31
     * @param string          $path
32
     */
33 11
    public function __construct(ReactFilesystem $filesystem, string $path)
34
    {
35 11
        $this->filesystem = $filesystem;
36 11
        $this->path = $path;
37 11
    }
38
39
    /**
40
     * @param  string           $key
41
     * @param  null|mixed       $default
42
     * @return PromiseInterface
43
     */
44 5
    public function get($key, $default = null): PromiseInterface
45
    {
46
        return $this->has($key)->then(function (bool $has) use ($key, $default) {
47 5
            if ($has === true) {
48 4
                return $this->getFile($key)->getContents();
49
            }
50
51 1
            return resolve($default);
52 5
        });
53
    }
54
55
    /**
56
     * @param string     $key
57
     * @param mixed      $value
58
     * @param null|mixed $ttl
59
     */
60 5
    public function set($key, $value, $ttl = null): PromiseInterface
61
    {
62 5
        $file = $this->getFile($key);
63 5
        if (\strpos($key, \DIRECTORY_SEPARATOR) === false) {
64 1
            return $this->putContents($file, $value);
65
        }
66
67 4
        $path = \explode(\DIRECTORY_SEPARATOR, $key);
68 4
        \array_pop($path);
69 4
        $path = \implode(\DIRECTORY_SEPARATOR, $path);
70
71 4
        $dir = $this->filesystem->dir($this->path . $path);
72
73
        return $dir->createRecursive()->then(null, function (Throwable $error) {
74 2
            if ($error->getMessage() === 'mkdir(): File exists') {
75 2
                return resolve(true);
76
            }
77
78
            return reject($error);
79
        })->then(function () use ($file, $value): PromiseInterface {
80 4
            return $this->putContents($file, $value);
81 4
        });
82
    }
83
84
    /**
85
     * @param string $key
86
     */
87 4
    public function delete($key): PromiseInterface
88
    {
89
        return $this->has($key)->then(function () use ($key): PromiseInterface {
90 4
            return $this->getFile($key)->remove();
91
        })->then(function () {
92 1
            return resolve(true);
93
        }, function () {
94 3
            return resolve(false);
95 4
        });
96
    }
97
98 2
    public function getMultiple(array $keys, $default = null): PromiseInterface
99
    {
100 2
        $promises = [];
101 2
        foreach ($keys as $key) {
102 2
            $promises[$key] = $this->get($key, $default);
103
        }
104
105 2
        return all($promises);
106
    }
107
108 2
    public function setMultiple(array $values, $ttl = null): PromiseInterface
109
    {
110 2
        $promises = [];
111 2
        foreach ($values as $key => $value) {
112 2
            $promises[$key] = $this->set($key, $value, $ttl);
113
        }
114
115 View Code Duplication
        return all($promises)->then(function ($results) {
116 2
            foreach ($results as $result) {
117 2
                if ($result === false) {
118
                    return resolve(false);
119
                }
120
            }
121
122 2
            return resolve(true);
123 2
        });
124
    }
125
126
    public function deleteMultiple(array $keys): PromiseInterface
127
    {
128
        $promises = [];
129
        foreach ($keys as $key) {
130
            $promises[$key] = $this->delete($key);
131
        }
132
133 View Code Duplication
        return all($promises)->then(function ($results) {
134
            foreach ($results as $result) {
135
                if ($result === false) {
136
                    return resolve(false);
137
                }
138
            }
139
140
            return resolve(true);
141
        });
142
    }
143
144 1
    public function clear(): PromiseInterface
145
    {
146
        return (new Promise(function ($resolve, $reject): void {
147 1
            $stream = $this->filesystem->dir($this->path)->lsRecursiveStreaming();
0 ignored issues
show
The method lsRecursiveStreaming() does not exist on React\Filesystem\Node\DirectoryInterface. Did you maybe mean lsRecursive()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
148
            $stream->on('data', function (NodeInterface $node) use ($reject): void {
149 1
                if ($node instanceof FileInterface === false) {
150 1
                    return;
151
                }
152
153 1
                $node->remove()->then(null, $reject);
154 1
            });
155 1
            $stream->on('error', $reject);
156 1
            $stream->on('close', $resolve);
157
        }))->then(function () {
158 1
            return resolve(true);
159 1
        });
160
    }
161
162 9
    public function has($key): PromiseInterface
163
    {
164
        return $this->getFile($key)->exists()->then(function () {
165 5
            return resolve(true);
166
        }, function () {
167 7
            return resolve(false);
168 9
        });
169
    }
170
171 5
    private function putContents(FileInterface $file, $value): PromiseInterface
172
    {
173
        return $file->putContents($value)->then(function () {
174 5
            return resolve(true);
175
        }, function () {
176
            return resolve(false);
177 5
        });
178
    }
179
180
    /**
181
     * @param $key
182
     * @return FileInterface
183
     */
184 11
    private function getFile($key): FileInterface
185
    {
186 11
        return $this->filesystem->file($this->path . $key);
187
    }
188
}
189