Issues (1131)

Security Analysis    not enabled

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/response/XmlrpcepiphpResponse.class.php (4 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
namespace Agavi\Response;
3
4
// +---------------------------------------------------------------------------+
5
// | This file is part of the Agavi package.                                   |
6
// | Copyright (c) 2005-2011 the Agavi Project.                                |
7
// |                                                                           |
8
// | For the full copyright and license information, please view the LICENSE   |
9
// | file that was distributed with this source code. You can also view the    |
10
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
11
// |   vi: set noexpandtab:                                                    |
12
// |   Local Variables:                                                        |
13
// |   indent-tabs-mode: t                                                     |
14
// |   End:                                                                    |
15
// +---------------------------------------------------------------------------+
16
use Agavi\Dispatcher\OutputType;
17
18
/**
19
 * XmlrpcepiphpResponse handles XMLRPC Web Service responses using the
20
 * XMLRPC-EPI extension for PHP.
21
 *
22
 * @package    agavi
23
 * @subpackage response
24
 *
25
 * @author     David Zülke <[email protected]>
26
 * @copyright  Authors
27
 * @copyright  The Agavi Project
28
 *
29
 * @since      0.11.0
30
 *
31
 * @version    $Id$
32
 */
33
class XmlrpcepiphpResponse extends Response
34
{
35
    /**
36
     * @var        array The content to send back with this response.
37
     */
38
    protected $content = array();
39
    
40
    /**
41
     * Check whether or not some content is set.
42
     *
43
     * @return     bool If any content is set, false otherwise.
44
     *
45
     * @author     David Zülke <[email protected]>
46
     * @since      0.11.6
47
     */
48
    public function hasContent()
49
    {
50
        return $this->content !== array();
51
    }
52
    
53
    /**
54
     * Set the content for this Response.
55
     *
56
     * @see        Response::setContent()
57
     *
58
     * @param      array $content The content to be sent in this Response.
59
     *
60
     * @return     bool Whether or not the operation was successful.
61
     *
62
     * @author     David Zülke <[email protected]>
63
     * @since      0.11.0
64
     */
65
    public function setContent($content)
66
    {
67
        return parent::setContent((array) $content);
68
    }
69
    
70
    /**
71
     * Prepend content to the existing content for this Response.
72
     *
73
     * @param      array $content The content to be prepended to this Response.
74
     *
75
     * @return     bool Whether or not the operation was successful.
76
     *
77
     * @author     David Zülke <[email protected]>
78
     * @since      0.11.0
79
     */
80
    public function prependContent($content)
81
    {
82
        return $this->setContent((array) $content + $this->getContent());
83
    }
84
    
85
    /**
86
     * Append content to the existing content for this Response.
87
     *
88
     * @param      array $content The content to be appended to this Response.
89
     *
90
     * @return     bool Whether or not the operation was successful.
91
     *
92
     * @author     David Zülke <[email protected]>
93
     * @since      0.11.0
94
     */
95
    public function appendContent($content)
96
    {
97
        return $this->setContent($this->getContent() + (array) $content);
98
    }
99
    
100
    /**
101
     * Import response metadata (nothing in this case) from another response.
102
     *
103
     * @param      Response $otherResponse The other response to import information from.
104
     *
105
     * @author     David Zülke <[email protected]>
106
     * @since      0.11.0
107
     */
108
    public function merge(Response $otherResponse)
109
    {
110
        parent::merge($otherResponse);
111
    }
112
    
113
    /**
114
     * Redirect externally. Not implemented here.
115
     *
116
     * @param      mixed $to Where to redirect.
117
     *
118
     * @throws     \BadMethodCallException
119
     *
120
     * @author     David Zülke <[email protected]>
121
     * @since      0.11.0
122
     */
123
    public function setRedirect($to)
124
    {
125
        throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.');
126
    }
127
    
128
    /**
129
     * Get info about the set redirect. Not implemented here.
130
     *
131
     * @throws     \BadMethodCallException
132
     *
133
     * @author     David Zülke <[email protected]>
134
     * @since      0.11.0
135
     */
136
    public function getRedirect()
137
    {
138
        throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.');
139
    }
140
141
    /**
142
     * Check if a redirect is set. Not implemented here.
143
     *
144
     * @return     bool true, if a redirect is set, otherwise false
145
     *
146
     * @throws     \BadMethodCallException
147
     *
148
     * @author     David Zülke <[email protected]>
149
     * @since      0.11.0
150
     */
151
    public function hasRedirect()
152
    {
153
        throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.');
154
    }
155
156
    /**
157
     * Clear any set redirect information. Not implemented here.
158
     *
159
     * @throws     \BadMethodCallException
160
     *
161
     * @author     David Zülke <[email protected]>
162
     * @since      0.11.0
163
     */
164
    public function clearRedirect()
165
    {
166
        throw new \BadMethodCallException('Redirects are not implemented for XMLRPC.');
167
    }
168
    
169
    /**
170
     * @see        Response::isMutable()
171
     *
172
     * @author     David Zülke <[email protected]>
173
     * @since      0.11.0
174
     */
175
    public function isContentMutable()
176
    {
177
        return false;
178
    }
179
    
180
    /**
181
     * Clear the content for this Response
182
     *
183
     * @return     bool Whether or not the operation was successful.
184
     *
185
     * @author     David Zülke <[email protected]>
186
     * @since      0.11.0
187
     */
188
    public function clearContent()
189
    {
190
        $this->content = array();
191
        return true;
192
    }
193
    
194
    /**
195
     * Send all response data to the client.
196
     *
197
     * @author     David Zülke <[email protected]>
198
     * @since      0.11.0
199
     */
200
    public function send(OutputType $outputType = null)
201
    {
202
        $encoding = array('encoding' => $this->getParameter('output_options[encoding]', 'utf-8'));
203
        if ($outputType) {
204
            $encoding = array('encoding' => $outputType->getParameter('encoding', $encoding['encoding']));
205
        }
206
        
207
        $outputOptions = array_merge(array('escaping' => array('markup', 'non-print')), (array) $this->getParameter('output_options', array()), $encoding);
208
        
209
        $this->content = xmlrpc_encode_request(null, $this->content, $outputOptions);
0 ignored issues
show
Documentation Bug introduced by
It seems like xmlrpc_encode_request(nu...ontent, $outputOptions) of type string is incompatible with the declared type array of property $content.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
210
        
211
        header('Content-Type: text/xml; charset=' . $outputOptions['encoding']);
212
//		header('Content-Length: ' . strlen($this->content));
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
213
        
214
        $this->sendContent();
215
    }
216
    
217
    /**
218
     * Clear all response data.
219
     *
220
     * @author     David Zülke <[email protected]>
221
     * @since      0.11.0
222
     */
223
    public function clear()
224
    {
225
        $this->clearContent();
226
        $this->httpHeaders = array();
0 ignored issues
show
The property httpHeaders does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
227
        $this->cookies = array();
0 ignored issues
show
The property cookies does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
228
    }
229
}
230