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

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/Filesystem/FilesystemManager.php (4 issues)

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 Nip\Filesystem;
4
5
use InvalidArgumentException;
6
use League\Flysystem\Adapter\Local as LocalAdapter;
7
use League\Flysystem\AdapterInterface;
8
use League\Flysystem\FilesystemInterface;
9
use Nip\Config\Config;
10
11
/**
12
 * Class FilesystemManager
13
 * @package Nip\Filesystem
14
 */
15
class FilesystemManager
16
{
17
    /**
18
     * The application instance.
19
     *
20
     * @var \Nip\Application
21
     */
22
    protected $app;
23
24
    /**
25
     * The array of resolved filesystem drivers.
26
     *
27
     * @var FileDisk[]
28
     */
29
    protected $disks = [];
30
31
    /**
32
     * The registered custom driver creators.
33
     *
34
     * @var array
35
     */
36
    protected $customCreators = [];
37
38
39
    /**
40
     * Create a new filesystem manager instance.
41
     *
42
     * @param  \Nip\Application $app
43
     */
44
    public function __construct($app)
45
    {
46
        $this->app = $app;
47
    }
48
49
    /**
50
     * Get a filesystem instance.
51
     *
52
     * @param  string $name
53
     * @return FileDisk
54
     */
55
    public function disk($name = null)
56
    {
57
        $name = $name ?: $this->getDefaultDriver();
58
        return $this->disks[$name] = $this->get($name);
59
    }
60
61
    /**
62
     * Get the default driver name.
63
     *
64
     * @return string
65
     */
66
    public function getDefaultDriver()
67
    {
68
        return config('filesystems.default');
69
    }
70
71
    /**
72
     * Attempt to get the disk from the local cache.
73
     *
74
     * @param  string $name
75
     * @return FileDisk
76
     */
77
    protected function get($name)
78
    {
79
        return isset($this->disks[$name]) ? $this->disks[$name] : $this->resolve($name);
80
    }
81
82
    /**
83
     * Resolve the given disk.
84
     *
85
     * @param  string $name
86
     * @return FileDisk
87
     *
88
     * @throws \InvalidArgumentException
89
     */
90
    protected function resolve($name)
91
    {
92
        $config = $this->getConfig($name)->toArray();
93
94
        if (isset($this->customCreators[$config['driver']])) {
95
            return $this->callCustomCreator($config);
96
        }
97
        $driverMethod = 'create' . ucfirst($config['driver']) . 'Driver';
98
        if (method_exists($this, $driverMethod)) {
99
            return $this->{$driverMethod}($config);
100
        } else {
101
            throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
102
        }
103
    }
104
105
    /**
106
     * Get the filesystem connection configuration.
107
     *
108
     * @param  string $name
109
     * @return Config
110
     */
111
    protected function getConfig($name)
112
    {
113
        return config("filesystems.disks.{$name}");
114
    }
115
116
    /**
117
     * Call a custom driver creator.
118
     *
119
     * @param  array $config
120
     * @return FileDisk
121
     */
122
    protected function callCustomCreator(array $config)
123
    {
124
        $driver = $this->customCreators[$config['driver']]($this->app, $config);
125
        if ($driver instanceof FilesystemInterface) {
126
            return $this->adapt($driver);
127
        }
128
        return $driver;
129
    }
130
131
    /**
132
     * Adapt the filesystem implementation.
133
     *
134
     * @param  \League\Flysystem\FilesystemInterface $filesystem
135
     * @return \League\Flysystem\FilesystemInterface|FileDisk
136
     */
137
    protected function adapt(FilesystemInterface $filesystem)
138
    {
139
        return $filesystem;
140
//        return new FlysystemAdapter($filesystem);
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
141
    }
142
143
    /**
144
     * Create an instance of the local driver.
145
     *
146
     * @param  array $config
147
     * @return \League\Flysystem\FilesystemInterface
148
     */
149
    public function createLocalDriver($config)
150
    {
151
        $permissions = isset($config['permissions']) ? $config['permissions'] : [];
152
        $links = [];
153
//        $links = Arr::get($config, 'links') === 'skip'
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
154
//            ? LocalAdapter::SKIP_LINKS
155
//            : LocalAdapter::DISALLOW_LINKS;
156
157
        return $this->adapt(
158
            $this->createDisk(
159
                new LocalAdapter(
160
                    $config['root'],
161
                    LOCK_EX,
162
                    $links,
0 ignored issues
show
$links is of type array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
163
                    $permissions
164
                ),
165
                $config
166
            )
167
        );
168
    }
169
170
    /**
171
     * Create a Flysystem instance with the given adapter.
172
     *
173
     * @param  \League\Flysystem\AdapterInterface $adapter
174
     * @param  array $config
175
     * @return FileDisk
176
     */
177
    protected function createDisk(AdapterInterface $adapter, $config)
178
    {
179
//        $config = Arr::only($config, ['visibility', 'disable_asserts', 'url']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
61% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
180
        return new FileDisk($adapter, count($config) > 0 ? $config : null);
181
    }
182
183
    /**
184
     * Set the given disk instance.
185
     *
186
     * @param  string $name
187
     * @param  FileDisk $disk
188
     * @return void
189
     */
190
    public function set($name, $disk)
191
    {
192
        $this->disks[$name] = $disk;
193
    }
194
195
    /**
196
     * Get the default cloud driver name.
197
     *
198
     * @return string
199
     */
200
    public function getDefaultCloudDriver()
201
    {
202
        return config('filesystems.cloud');
203
    }
204
}
205