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/ElementHandler.php (1 issue)

Labels
Severity
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\Exception\BuildException;
24
use Phing\RuntimeConfigurable;
25
use Phing\Target;
26
use Phing\UnknownElement;
27
28
/**
29
 * The generic element handler class.
30
 *
31
 * This class handles the occurrence of runtime registered tags like
32
 * datatypes (fileset, patternset, etc) and it's possible nested tags. It
33
 * introspects the implementation of the class and sets up the data structures.
34
 *
35
 * @author    Michiel Rook <[email protected]>
36
 * @copyright 2001,2002 THYRELL. All rights reserved
37
 */
38
class ElementHandler extends AbstractHandler
39
{
40
    /**
41
     * Reference to the parent object that represents the parent tag
42
     * of this nested element.
43
     *
44
     * @var object
45
     */
46
    private $parent;
47
48
    /**
49
     * Reference to the child object that represents the child tag
50
     * of this nested element.
51
     *
52
     * @var UnknownElement
53
     */
54
    private $child;
55
56
    /**
57
     *  Reference to the parent wrapper object.
58
     *
59
     * @var RuntimeConfigurable
60
     */
61
    private $parentWrapper;
62
63
    /**
64
     *  Reference to the child wrapper object.
65
     *
66
     * @var RuntimeConfigurable
67
     */
68
    private $childWrapper;
69
70
    /**
71
     *  Reference to the related target object.
72
     *
73
     * @var Target the target instance
74
     */
75
    private $target;
76
77
    /**
78
     * @var ProjectConfigurator
79
     */
80
    private $configurator;
81
82
    /**
83
     *  Constructs a new NestedElement handler and sets up everything.
84
     *
85
     * @param AbstractSAXParser   $parser        the ExpatParser object
86
     * @param AbstractHandler     $parentHandler the parent handler that invoked this handler
87
     * @param ProjectConfigurator $configurator  the ProjectConfigurator object
88
     * @param UnknownElement      $parent        the parent object this element is contained in
89
     * @param RuntimeConfigurable $parentWrapper the parent wrapper object
90
     * @param Target              $target        the target object this task is contained in
91
     */
92
    public function __construct(
93
        AbstractSAXParser $parser,
94
        AbstractHandler $parentHandler,
95
        ProjectConfigurator $configurator,
96
        ?UnknownElement $parent = null,
97
        ?RuntimeConfigurable $parentWrapper = null,
98
        ?Target $target = null
99
    ) {
100
        parent::__construct($parser, $parentHandler);
101
        $this->configurator = $configurator;
102
        if (null != $parentWrapper) {
103
            $this->parent = $parentWrapper->getProxy();
104
        } else {
105
            $this->parent = $parent;
106
        }
107
        $this->parentWrapper = $parentWrapper;
108
        $this->target = $target;
109
    }
110
111
    /**
112
     * Executes initialization actions required to setup the data structures
113
     * related to the tag.
114
     * <p>
115
     * This includes:
116
     * <ul>
117
     * <li>creation of the nested element</li>
118
     * <li>calling the setters for attributes</li>
119
     * <li>adding the element to the container object</li>
120
     * <li>adding a reference to the element (if id attribute is given)</li>
121
     * </ul>.
122
     *
123
     * @param string $tag   the tag that comes in
124
     * @param array  $attrs attributes the tag carries
125
     *
126
     * @throws ExpatParseException if the setup process fails
127
     */
128
    public function init($tag, $attrs)
129
    {
130
        $configurator = $this->configurator;
131
        $project = $this->configurator->project;
132
133
        try {
134
            $this->child = new UnknownElement(strtolower($tag));
135
            $this->child->setTaskName($tag);
136
            $this->child->setTaskType($tag);
137
            $this->child->setProject($project);
138
            $this->child->setLocation($this->parser->getLocation());
0 ignored issues
show
The method getLocation() does not exist on Phing\Parser\AbstractSAXParser. Since it exists in all sub-types, consider adding an abstract or default implementation to Phing\Parser\AbstractSAXParser. ( Ignorable by Annotation )

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

138
            $this->child->setLocation($this->parser->/** @scrutinizer ignore-call */ getLocation());
Loading history...
139
140
            if (null !== $this->target) {
141
                $this->child->setOwningTarget($this->target);
142
            }
143
144
            if (null !== $this->parent) {
145
                $this->parent->addChild($this->child);
146
            } elseif (null !== $this->target) {
147
                $this->target->addTask($this->child);
148
            }
149
150
            $configurator->configureId($this->child, $attrs);
151
152
            $this->childWrapper = new RuntimeConfigurable($this->child, $tag);
153
            $this->childWrapper->setAttributes($attrs);
154
155
            if (null !== $this->parentWrapper) {
156
                $this->parentWrapper->addChild($this->childWrapper);
157
            }
158
        } catch (BuildException $exc) {
159
            throw new ExpatParseException(
160
                "Error initializing nested element <{$tag}>",
161
                $exc,
162
                $this->parser->getLocation()
163
            );
164
        }
165
    }
166
167
    /**
168
     * Handles character data.
169
     *
170
     * @param string $data the CDATA that comes in
171
     *
172
     * @throws ExpatParseException if the CDATA could not be set-up properly
173
     */
174
    public function characters($data)
175
    {
176
        $this->childWrapper->addText($data);
177
    }
178
179
    /**
180
     * Checks for nested tags within the current one. Creates and calls
181
     * handlers respectively.
182
     *
183
     * @param string $name  the tag that comes in
184
     * @param array  $attrs attributes the tag carries
185
     */
186
    public function startElement($name, $attrs)
187
    {
188
        $eh = new ElementHandler(
189
            $this->parser,
190
            $this,
191
            $this->configurator,
192
            $this->child,
193
            $this->childWrapper,
194
            $this->target
195
        );
196
        $eh->init($name, $attrs);
197
    }
198
}
199