Issues (100)

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.

FileSystem/PrimaryFileSystemWrapper.php (2 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
 * This file is part of the IrishDan\ResponsiveImageBundle package.
4
 *
5
 * (c) Daniel Byrne <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source
8
 * code.
9
 */
10
11
namespace IrishDan\ResponsiveImageBundle\FileSystem;
12
13
use IrishDan\ResponsiveImageBundle\Event\FileSystemEvent;
14
use IrishDan\ResponsiveImageBundle\Event\FileSystemEvents;
15
use League\Flysystem\FilesystemInterface;
16
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
17
18
/**
19
 * Class PrimaryFileSystemWrapper
20
 *
21
 * This is a wrapper around a flysystem filesystem.
22
 * It includes some helper methods for easy access to flysystem.
23
 * If event dispatcher is injected it will fire events whenerever the filesystem is set is gotten.
24
 * This is to allow for swapping of filesystem.
25
 *
26
 * @package IrishDan\ResponsiveImageBundle\FileSystem
27
 */
28
class PrimaryFileSystemWrapper
29
{
30
    /**
31
     * @var FilesystemInterface
32
     */
33
    private $fileSystem;
34
    /**
35
     * @var EventDispatcherInterface
36
     */
37
    private $eventDispatcher;
38
39
    /**
40
     * PrimaryFileSystemWrapper constructor.
41
     *
42
     * @param EventDispatcherInterface|null $eventDispatcher
43
     * @param FilesystemInterface|null      $fileSystem
44
     */
45
    public function __construct(EventDispatcherInterface $eventDispatcher = null, FilesystemInterface $fileSystem = null)
46
    {
47
        $this->eventDispatcher = $eventDispatcher;
48
        $this->fileSystem      = $fileSystem;
49
    }
50
51
    /**
52
     * @return FilesystemInterface|null
53
     */
54 View Code Duplication
    public function getFileSystem()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        if (!empty($this->eventDispatcher)) {
57
            $fileSystemEvent = new FileSystemEvent($this);
58
            $this->eventDispatcher->dispatch(FileSystemEvents::FILE_SYSTEM_FACTORY_GET, $fileSystemEvent);
59
        }
60
61
        return $this->fileSystem;
62
    }
63
64
    public function getAdapter()
65
    {
66
        if (!empty($this->fileSystem)) {
67
            return $this->fileSystem->getAdapter();
68
        }
69
70
        return null;
71
    }
72
73
    /**
74
     * @param FilesystemInterface $fileSystem
75
     */
76 View Code Duplication
    public function setFileSystem(FilesystemInterface $fileSystem)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        if (!empty($this->eventDispatcher)) {
79
            $fileSystemEvent = new FileSystemEvent($this);
80
            $this->eventDispatcher->dispatch(FileSystemEvents::FILE_SYSTEM_FACTORY_SET, $fileSystemEvent);
81
        }
82
        $this->fileSystem = $fileSystem;
83
    }
84
85
    /**
86
     * @param $path
87
     * @param $contents
88
     */
89
    public function write($path, $contents)
90
    {
91
        $this->fileSystem->write($path, $contents);
92
    }
93
94
    /**
95
     * @param $path
96
     * @param $contents
97
     */
98
    public function update($path, $contents)
99
    {
100
        $this->fileSystem->update($path, $contents);
101
    }
102
103
    /**
104
     * @param $path
105
     * @param $contents
106
     */
107
    public function put($path, $contents)
108
    {
109
        $this->fileSystem->put($path, $contents);
110
    }
111
112
    /**
113
     * @param $path
114
     *
115
     * @return false|string
116
     */
117
    public function read($path)
118
    {
119
        return $this->fileSystem->read($path);
120
    }
121
122
    /**
123
     * @param $path
124
     *
125
     * @return bool
126
     */
127
    public function has($path)
128
    {
129
        return $this->fileSystem->has($path);
130
    }
131
132
    /**
133
     * @param $path
134
     */
135
    public function delete($path)
136
    {
137
        $this->fileSystem->delete($path);
138
    }
139
140
    /**
141
     * @param $path
142
     *
143
     * @return false|string
144
     */
145
    public function readAndDelete($path)
146
    {
147
        return $this->fileSystem->readAndDelete($path);
148
    }
149
150
    /**
151
     * @param $currentPath
152
     * @param $newPath
153
     */
154
    public function rename($currentPath, $newPath)
155
    {
156
        $this->fileSystem->rename($currentPath, $newPath);
157
    }
158
159
    /**
160
     * @param $currentPath
161
     * @param $duplicatePath
162
     */
163
    public function copy($currentPath, $duplicatePath)
164
    {
165
        $this->fileSystem->copy($currentPath, $duplicatePath);
166
    }
167
168
    /**
169
     * @param $path
170
     *
171
     * @return false|string
172
     */
173
    public function getMimetype($path)
174
    {
175
        return $this->fileSystem->getMimetype($path);
176
    }
177
178
    /**
179
     * @param $path
180
     *
181
     * @return false|string
182
     */
183
    public function getTimeStamp($path)
184
    {
185
        return $this->fileSystem->getTimestamp($path);
186
    }
187
188
    /**
189
     * @param $path
190
     *
191
     * @return false|int
192
     */
193
    public function getSize($path)
194
    {
195
        return $this->fileSystem->getSize($path);
196
    }
197
198
    /**
199
     * @param $path
200
     */
201
    public function createDir($path)
202
    {
203
        $this->fileSystem->createDir($path);
204
    }
205
206
    /**
207
     * @param $path
208
     */
209
    public function deleteDir($path)
210
    {
211
        $this->fileSystem->deleteDir($path);
212
    }
213
}