Issues (48)

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/Adapter/AdapterContainer.php (8 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
/*
4
 * This file is part of Zippy.
5
 *
6
 * (c) Alchemy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Alchemy\Zippy\Adapter;
13
14
use Alchemy\Zippy\Adapter\BSDTar\TarBSDTarAdapter;
15
use Alchemy\Zippy\Adapter\BSDTar\TarBz2BSDTarAdapter;
16
use Alchemy\Zippy\Adapter\BSDTar\TarGzBSDTarAdapter;
17
use Alchemy\Zippy\Adapter\GNUTar\TarBz2GNUTarAdapter;
18
use Alchemy\Zippy\Adapter\GNUTar\TarGNUTarAdapter;
19
use Alchemy\Zippy\Adapter\GNUTar\TarGzGNUTarAdapter;
20
use Alchemy\Zippy\Resource\RequestMapper;
21
use Alchemy\Zippy\Resource\ResourceManager;
22
use Alchemy\Zippy\Resource\ResourceTeleporter;
23
use Alchemy\Zippy\Resource\TargetLocator;
24
use Alchemy\Zippy\Resource\TeleporterContainer;
25
use Symfony\Component\Filesystem\Filesystem;
26
use Symfony\Component\Process\ExecutableFinder;
27
28
class AdapterContainer implements \ArrayAccess
29
{
30
31
    private $items = array();
32
33
    /**
34
     * Builds the adapter container
35
     *
36
     * @return AdapterContainer
37
     */
38
    public static function load()
39
    {
40
        $container = new static();
41
42
        $container['zip.inflator'] = null;
43
        $container['zip.deflator'] = null;
44
45
        $container['resource-manager'] = function($container) {
46
            return new ResourceManager(
47
                $container['request-mapper'],
48
                $container['resource-teleporter'],
49
                $container['filesystem']
50
            );
51
        };
52
53
        $container['executable-finder'] = function($container) {
0 ignored issues
show
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
54
            return new ExecutableFinder();
55
        };
56
57
        $container['request-mapper'] = function($container) {
58
            return new RequestMapper($container['target-locator']);
59
        };
60
61
        $container['target-locator'] = function() {
62
            return new TargetLocator();
63
        };
64
65
        $container['teleporter-container'] = function($container) {
0 ignored issues
show
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
66
            return TeleporterContainer::load();
67
        };
68
69
        $container['resource-teleporter'] = function($container) {
70
            return new ResourceTeleporter($container['teleporter-container']);
71
        };
72
73
        $container['filesystem'] = function() {
74
            return new Filesystem();
75
        };
76
77
        $container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function($container) {
78
            return ZipAdapter::newInstance(
79
                $container['executable-finder'],
80
                $container['resource-manager'],
81
                $container['zip.inflator'],
82
                $container['zip.deflator']
83
            );
84
        };
85
86
        $container['gnu-tar.inflator'] = null;
87
        $container['gnu-tar.deflator'] = null;
88
89 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
90
            return TarGNUTarAdapter::newInstance(
91
                $container['executable-finder'],
92
                $container['resource-manager'],
93
                $container['gnu-tar.inflator'],
94
                $container['gnu-tar.deflator']
95
            );
96
        };
97
98 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
99
            return TarGzGNUTarAdapter::newInstance(
100
                $container['executable-finder'],
101
                $container['resource-manager'],
102
                $container['gnu-tar.inflator'],
103
                $container['gnu-tar.deflator']
104
            );
105
        };
106
107 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
108
            return TarBz2GNUTarAdapter::newInstance(
109
                $container['executable-finder'],
110
                $container['resource-manager'],
111
                $container['gnu-tar.inflator'],
112
                $container['gnu-tar.deflator']
113
            );
114
        };
115
116
        $container['bsd-tar.inflator'] = null;
117
        $container['bsd-tar.deflator'] = null;
118
119 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
120
            return TarBSDTarAdapter::newInstance(
121
                $container['executable-finder'],
122
                $container['resource-manager'],
123
                $container['bsd-tar.inflator'],
124
                $container['bsd-tar.deflator']
125
            );
126
        };
127
128 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
129
            return TarGzBSDTarAdapter::newInstance(
130
                $container['executable-finder'],
131
                $container['resource-manager'],
132
                $container['bsd-tar.inflator'],
133
                $container['bsd-tar.deflator']
134
            );
135
        };
136
137 View Code Duplication
        $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
138
            return TarBz2BSDTarAdapter::newInstance(
139
                $container['executable-finder'],
140
                $container['resource-manager'],
141
                $container['bsd-tar.inflator'],
142
                $container['bsd-tar.deflator']);
143
        };
144
145
        $container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function() {
146
            return ZipExtensionAdapter::newInstance();
147
        };
148
149
        return $container;
150
    }
151
152
    /**
153
     * (PHP 5 &gt;= 5.0.0)<br/>
154
     * Whether a offset exists
155
     *
156
     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
157
     *
158
     * @param mixed $offset <p>
159
     *                      An offset to check for.
160
     *                      </p>
161
     *
162
     * @return bool true on success or false on failure.
163
     * <p>The return value will be casted to boolean if non-boolean was returned.</p>
164
     */
165
    public function offsetExists($offset)
166
    {
167
        return isset($this->items[$offset]);
168
    }
169
170
    /**
171
     * (PHP 5 &gt;= 5.0.0)<br/>
172
     * Offset to retrieve
173
     * @link http://php.net/manual/en/arrayaccess.offsetget.php
174
     * @param mixed $offset <p>
175
     * The offset to retrieve.
176
     * </p>
177
     * @return mixed Can return all value types.
178
     */
179
    public function offsetGet($offset)
180
    {
181
        if (array_key_exists($offset, $this->items) && is_callable($this->items[$offset])) {
182
            $this->items[$offset] = call_user_func($this->items[$offset], $this);
183
        }
184
185
        if (array_key_exists($offset, $this->items)) {
186
            return $this->items[$offset];
187
        }
188
189
        throw new \InvalidArgumentException();
190
    }
191
192
    /**
193
     * (PHP 5 &gt;= 5.0.0)<br/>
194
     * Offset to set
195
     * @link http://php.net/manual/en/arrayaccess.offsetset.php
196
     * @param mixed $offset <p>
197
     * The offset to assign the value to.
198
     * </p>
199
     * @param mixed $value <p>
200
     * The value to set.
201
     * </p>
202
     * @return void
203
     */
204
    public function offsetSet($offset, $value)
205
    {
206
        $this->items[$offset] = $value;
207
    }
208
209
    /**
210
     * (PHP 5 &gt;= 5.0.0)<br/>
211
     * Offset to unset
212
     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
213
     * @param mixed $offset <p>
214
     * The offset to unset.
215
     * </p>
216
     * @return void
217
     */
218
    public function offsetUnset($offset)
219
    {
220
        unset($this->items[$offset]);
221
    }
222
}
223