Issues (58)

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\TarGzBSDTarAdapter;
16
use Alchemy\Zippy\Adapter\BSDTar\TarBz2BSDTarAdapter;
17
use Alchemy\Zippy\Adapter\GNUTar\TarGNUTarAdapter;
18
use Alchemy\Zippy\Adapter\GNUTar\TarGzGNUTarAdapter;
19
use Alchemy\Zippy\Adapter\GNUTar\TarBz2GNUTarAdapter;
20
use Alchemy\Zippy\Resource\ResourceManager;
21
use Alchemy\Zippy\Resource\RequestMapper;
22
use Alchemy\Zippy\Resource\TeleporterContainer;
23
use Alchemy\Zippy\Resource\ResourceTeleporter;
24
use Alchemy\Zippy\Resource\TargetLocator;
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
     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
156
     * @param mixed $offset <p>
157
     * An offset to check for.
158
     * </p>
159
     * @return boolean true on success or false on failure.
160
     * </p>
161
     * <p>
162
     * The return value will be casted to boolean if non-boolean was returned.
163
     */
164
    public function offsetExists($offset)
165
    {
166
        return isset($this->items[$offset]);
167
    }
168
169
    /**
170
     * (PHP 5 &gt;= 5.0.0)<br/>
171
     * Offset to retrieve
172
     * @link http://php.net/manual/en/arrayaccess.offsetget.php
173
     * @param mixed $offset <p>
174
     * The offset to retrieve.
175
     * </p>
176
     * @return mixed Can return all value types.
177
     */
178
    public function offsetGet($offset)
179
    {
180
        if (array_key_exists($offset, $this->items) && is_callable($this->items[$offset])) {
181
            $this->items[$offset] = call_user_func($this->items[$offset], $this);
182
        }
183
184
        if (array_key_exists($offset, $this->items)) {
185
            return $this->items[$offset];
186
        }
187
188
        throw new \InvalidArgumentException();
189
    }
190
191
    /**
192
     * (PHP 5 &gt;= 5.0.0)<br/>
193
     * Offset to set
194
     * @link http://php.net/manual/en/arrayaccess.offsetset.php
195
     * @param mixed $offset <p>
196
     * The offset to assign the value to.
197
     * </p>
198
     * @param mixed $value <p>
199
     * The value to set.
200
     * </p>
201
     * @return void
202
     */
203
    public function offsetSet($offset, $value)
204
    {
205
        $this->items[$offset] = $value;
206
    }
207
208
    /**
209
     * (PHP 5 &gt;= 5.0.0)<br/>
210
     * Offset to unset
211
     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
212
     * @param mixed $offset <p>
213
     * The offset to unset.
214
     * </p>
215
     * @return void
216
     */
217
    public function offsetUnset($offset)
218
    {
219
        unset($this->items[$offset]);
220
    }
221
}
222