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/Parser/ProjectHandler.php (2 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\Parser;
22
23
use Phing\Io\File;
24
use Phing\Util\StringHelper;
25
26
/**
27
 * Handler class for the <project> XML element This class handles all elements
28
 * under the <project> element.
29
 *
30
 * @author    Andreas Aderhold <[email protected]>
31
 * @copyright (c) 2001,2002 THYRELL. All rights reserved
32
 */
33
class ProjectHandler extends AbstractHandler
34
{
35
    /**
36
     * The phing project configurator object.
37
     *
38
     * @var ProjectConfigurator
39
     */
40
    private $configurator;
41
42
    /**
43
     * @var XmlContext
44
     */
45
    private $context;
46
47
    /**
48
     * Constructs a new ProjectHandler.
49
     *
50
     * @param ExpatParser         $parser        the ExpatParser object
51
     * @param AbstractHandler     $parentHandler the parent handler that invoked this handler
52
     * @param ProjectConfigurator $configurator  the ProjectConfigurator object
53
     */
54 906
    public function __construct(
55
        ExpatParser $parser,
56
        AbstractHandler $parentHandler,
57
        ProjectConfigurator $configurator,
58
        XmlContext $context
59
    ) {
60 906
        parent::__construct($parser, $parentHandler);
61
62 906
        $this->configurator = $configurator;
63 906
        $this->context = $context;
64
    }
65
66
    /**
67
     * Executes initialization actions required to setup the project. Usually
68
     * this method handles the attributes of a tag.
69
     *
70
     * @param string $tag   the tag that comes in
71
     * @param array  $attrs attributes the tag carries
72
     *
73
     * @throws ExpatParseException if attributes are incomplete or invalid
74
     */
75 906
    public function init($tag, $attrs)
0 ignored issues
show
The parameter $tag 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

75
    public function init(/** @scrutinizer ignore-unused */ $tag, $attrs)

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...
76
    {
77 906
        $def = null;
78 906
        $name = null;
79 906
        $id = null;
80 906
        $desc = null;
81 906
        $baseDir = null;
82 906
        $ver = null;
83 906
        $strict = null;
84
85
        // some shorthands
86 906
        $project = $this->configurator->project;
87 906
        $buildFileParent = $this->configurator->buildFileParent;
88
89 906
        foreach ($attrs as $key => $value) {
90 906
            if ('default' === $key) {
91 906
                $def = $value;
92 897
            } elseif ('name' === $key) {
93 897
                $name = $value;
94 99
            } elseif ('id' === $key) {
95
                $id = $value;
96 99
            } elseif ('basedir' === $key) {
97 99
                $baseDir = $value;
98
            } elseif ('description' === $key) {
99
                $desc = $value;
100
            } elseif ('phingVersion' === $key) {
101
                $ver = $value;
102
            } elseif ('strict' === $key) {
103
                $strict = $value;
104
            } else {
105
                throw new ExpatParseException("Unexpected attribute '{$key}'");
106
            }
107
        }
108
        // these things get done no matter what
109 906
        if (null == $name) {
110 18
            $name = basename($this->configurator->getBuildFile());
111
        }
112
113 906
        $canonicalName = self::canonicalName($name);
114 906
        $this->configurator->setCurrentProjectName($canonicalName);
115 906
        $path = (string) $this->configurator->getBuildFile();
116 906
        $project->setUserProperty("phing.file.{$canonicalName}", $path);
117 906
        $project->setUserProperty("phing.dir.{$canonicalName}", dirname($path));
118
119 906
        if ($this->configurator->isIgnoringProjectTag()) {
120 101
            return;
121
        }
122
123 906
        if (null === $def) {
124
            throw new ExpatParseException(
125
                'The default attribute of project is required'
126
            );
127
        }
128
129 906
        $project->setDefaultTarget($def);
130
131 906
        if (null !== $name) {
132 906
            $project->setName($name);
133 906
            $project->addReference($name, $project);
134
        }
135
136 906
        if (null !== $id) {
137
            $project->addReference($id, $project);
138
        }
139
140 906
        if (null !== $desc) {
141
            $project->setDescription($desc);
142
        }
143
144 906
        if (null !== $ver) {
145
            $project->setPhingVersion($ver);
146
        }
147
148 906
        if (null !== $strict) {
149
            $project->setStrictMode(StringHelper::booleanValue($strict));
150
        }
151
152 906
        if (null !== $project->getProperty('project.basedir')) {
153 26
            $project->setBasedir($project->getProperty('project.basedir'));
154
        } else {
155 906
            if (null === $baseDir) {
156 808
                $project->setBasedir($buildFileParent->getAbsolutePath());
157
            } else {
158
                // check whether the user has specified an absolute path
159 99
                $f = new File($baseDir);
160 99
                if ($f->isAbsolute()) {
161
                    $project->setBasedir($baseDir);
162
                } else {
163 99
                    $project->setBaseDir($project->resolveFile($baseDir, $buildFileParent));
164
                }
165
            }
166
        }
167
168 906
        $project->addTarget('', $this->context->getImplicitTarget());
169
    }
170
171
    /**
172
     * Handles start elements within the <project> tag by creating and
173
     * calling the required handlers for the detected element.
174
     *
175
     * @param string $name  the tag that comes in
176
     * @param array  $attrs attributes the tag carries
177
     *
178
     * @throws ExpatParseException if a unxepected element occurs
179
     */
180 906
    public function startElement($name, $attrs)
181
    {
182 906
        $project = $this->configurator->project;
183 906
        $types = $project->getDataTypeDefinitions();
0 ignored issues
show
The assignment to $types is dead and can be removed.
Loading history...
184
185 906
        if ('target' === $name || 'extension-point' === $name) {
186 906
            $tf = new TargetHandler($this->parser, $this, $this->configurator, $this->context);
187 906
            $tf->init($name, $attrs);
188
        } else {
189 528
            $tf = new ElementHandler(
190 528
                $this->parser,
191 528
                $this,
192 528
                $this->configurator,
193 528
                null,
194 528
                null,
195 528
                $this->context->getImplicitTarget()
196 528
            );
197 528
            $tf->init($name, $attrs);
198
        }
199
    }
200
201
    /**
202
     * @param $name
203
     */
204 906
    public static function canonicalName($name)
205
    {
206 906
        return preg_replace('/\W/', '_', strtolower($name));
207
    }
208
}
209