Issues (557)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Phing/Io/ExtendedFileStream.php (10 issues)

1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
namespace Phing\Io;
22
23
use Phing\Exception\BuildException;
24
25
/**
26
 * Extended file stream wrapper class which auto-creates directories.
27
 *
28
 * @author  Michiel Rook <[email protected]>
29
 */
30
class ExtendedFileStream
31
{
32
    private $fp;
33
34
    public static function registerStream()
35
    {
36
        if (!in_array('efile', stream_get_wrappers())) {
37
            stream_wrapper_register('efile', __CLASS__);
38
        }
39
    }
40
41
    public static function unregisterStream()
42
    {
43
        stream_wrapper_unregister('efile');
44
    }
45
46
    // @codingStandardsIgnoreStart
47
48
    /**
49
     * @param $path
50
     * @param $mode
51
     * @param $options
52
     * @param $opened_path
53
     *
54
     * @throws IOException
55
     *
56
     * @return bool
57
     */
58
    public function stream_open($path, $mode, $options, &$opened_path)
0 ignored issues
show
The parameter $opened_path is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

58
    public function stream_open($path, $mode, $options, /** @scrutinizer ignore-unused */ &$opened_path)

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

Loading history...
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

58
    public function stream_open($path, $mode, /** @scrutinizer ignore-unused */ $options, &$opened_path)

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

Loading history...
59
    {
60
        // if we're on Windows, urldecode() the path again
61
        if ('\\' == FileSystem::getFileSystem()->getSeparator()) {
62
            $path = urldecode($path);
63
        }
64
65
        $filepath = substr($path, 8);
66
67
        $this->createDirectories(dirname($filepath));
68
69
        $this->fp = fopen($filepath, $mode);
70
71
        if (!$this->fp) {
72
            throw new BuildException("Unable to open stream for path {$path}");
73
        }
74
75
        return true;
76
    }
77
78
    public function stream_close()
79
    {
80
        fclose($this->fp);
81
        $this->fp = null;
82
    }
83
84
    /**
85
     * @param $count
86
     *
87
     * @return string
88
     */
89
    public function stream_read($count)
90
    {
91
        return fread($this->fp, $count);
92
    }
93
94
    /**
95
     * @param $data
96
     *
97
     * @return int
98
     */
99
    public function stream_write($data)
100
    {
101
        return fwrite($this->fp, $data);
102
    }
103
104
    /**
105
     * @return bool
106
     */
107
    public function stream_eof()
108
    {
109
        return feof($this->fp);
110
    }
111
112
    /**
113
     * @return int
114
     */
115
    public function stream_tell()
116
    {
117
        return ftell($this->fp);
118
    }
119
120
    /**
121
     * @param $offset
122
     * @param $whence
123
     *
124
     * @return int
125
     */
126
    public function stream_seek($offset, $whence)
127
    {
128
        return fseek($this->fp, $offset, $whence);
129
    }
130
131
    /**
132
     * @return bool
133
     */
134
    public function stream_flush()
135
    {
136
        return fflush($this->fp);
137
    }
138
139
    /**
140
     * @return array
141
     */
142
    public function stream_stat()
143
    {
144
        return fstat($this->fp);
145
    }
146
147
    // @codingStandardsIgnoreEnd
148
149
    /**
150
     * @param  $path
151
     *
152
     * @return bool
153
     */
154
    public function unlink($path)
0 ignored issues
show
The parameter $path is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

154
    public function unlink(/** @scrutinizer ignore-unused */ $path)

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

Loading history...
155
    {
156
        return false;
157
    }
158
159
    /**
160
     * @param  $path_from
161
     * @param  $path_to
162
     *
163
     * @return bool
164
     */
165
    public function rename($path_from, $path_to)
0 ignored issues
show
The parameter $path_to is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

165
    public function rename($path_from, /** @scrutinizer ignore-unused */ $path_to)

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

Loading history...
The parameter $path_from is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

165
    public function rename(/** @scrutinizer ignore-unused */ $path_from, $path_to)

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

Loading history...
166
    {
167
        return false;
168
    }
169
170
    /**
171
     * @param  $path
172
     * @param  $mode
173
     * @param  $options
174
     *
175
     * @return bool
176
     */
177
    public function mkdir($path, $mode, $options)
0 ignored issues
show
The parameter $path is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

177
    public function mkdir(/** @scrutinizer ignore-unused */ $path, $mode, $options)

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

Loading history...
The parameter $mode is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

177
    public function mkdir($path, /** @scrutinizer ignore-unused */ $mode, $options)

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

Loading history...
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

177
    public function mkdir($path, $mode, /** @scrutinizer ignore-unused */ $options)

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

Loading history...
178
    {
179
        return false;
180
    }
181
182
    /**
183
     * @param  $path
184
     * @param  $options
185
     *
186
     * @return bool
187
     */
188
    public function rmdir($path, $options)
0 ignored issues
show
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

188
    public function rmdir($path, /** @scrutinizer ignore-unused */ $options)

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

Loading history...
The parameter $path is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

188
    public function rmdir(/** @scrutinizer ignore-unused */ $path, $options)

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

Loading history...
189
    {
190
        return false;
191
    }
192
193
    /**
194
     * @param $path
195
     */
196
    private function createDirectories($path)
197
    {
198
        $f = new File($path);
199
        if (!$f->exists()) {
200
            $f->mkdirs();
201
        }
202
    }
203
}
204