Issues (18)

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.

AppserverIo/RemoteMethodInvocation/LocalProxy.php (4 issues)

Labels

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
 * \AppserverIo\RemoteMethodInvocation\LocalProxy
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/rmi
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\RemoteMethodInvocation;
22
23
use AppserverIo\Psr\EnterpriseBeans\BeanContextInterface;
24
use AppserverIo\Psr\EnterpriseBeans\Description\SessionBeanDescriptorInterface;
25
use AppserverIo\Psr\EnterpriseBeans\Description\StatefulSessionBeanDescriptorInterface;
26
27
/**
28
 * Local proxy implementation.
29
 *
30
 * @author    Tim Wagner <[email protected]>
31
 * @copyright 2015 TechDivision GmbH <[email protected]>
32
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
33
 * @link      https://github.com/appserver-io/rmi
34
 * @link      http://www.appserver.io
35
 */
36
class LocalProxy implements RemoteObjectInterface
37
{
38
39
    /**
40
     * The bean manager instance.
41
     *
42
     * @var \AppserverIo\Psr\EnterpriseBeans\BeanContextInterface
43
     */
44
    protected $beanManager;
45
46
    /**
47
     * The session bean descriptor.
48
     *
49
     * @var \AppserverIo\Psr\EnterpriseBeans\Description\SessionBeanDescriptorInterface
50
     */
51
    protected $sessionBeanDescriptor;
52
53
    /**
54
     * The session been that has to be proxied.
55
     *
56
     * @var object
57
     */
58
    protected $sessionBean;
59
60
    /**
61
     * The actual session ID.
62
     *
63
     * @var string
64
     */
65
    protected $sessionId;
66
67
    /**
68
     * Initialize the local proxy.
69
     *
70
     * @param \AppserverIo\Psr\EnterpriseBeans\BeanContextInterface                       $beanManager           The bean manager instance
71
     * @param \AppserverIo\Psr\EnterpriseBeans\Description\SessionBeanDescriptorInterface $sessionBeanDescriptor The session bean descriptor
72
     * @param object                                                                      $sessionBean           The session been that has to be proxied
73
     * @param string                                                                      $sessionId             The actual session ID
74
     */
75 4
    public function __construct(
76
        BeanContextInterface $beanManager,
77
        SessionBeanDescriptorInterface $sessionBeanDescriptor,
78
        $sessionBean,
79
        $sessionId
80
    ) {
81 4
        $this->beanManager = $beanManager;
82 4
        $this->sessionBeanDescriptor = $sessionBeanDescriptor;
83 4
        $this->sessionBean = $sessionBean;
84 4
        $this->sessionId = $sessionId;
85 4
    }
86
87
    /**
88
     * Sets the session with the connection instance.
89
     *
90
     * @param \AppserverIo\RemoteMethodInvocation\SessionInterface $session The session instance to use
91
     *
92
     * @return \AppserverIo\RemoteMethodInvocation\RemoteObjectInterface The instance itself
93
     */
94 1
    public function __setSession(SessionInterface $session)
95
    {
96 1
        throw new \Exception(sprintf('Method %s must NOT be invoked on a local proxy', __METHOD__));
97
    }
98
99
    /**
100
     * Returns the session instance.
101
     *
102
     * @return \AppserverIo\RemoteMethodInvocation\SessionInterface The session instance
103
     */
104 1
    public function __getSession()
105
    {
106 1
        throw new \Exception(sprintf('Method %s must NOT be invoked on a local proxy', __METHOD__));
107
    }
108
109
    /**
110
     * The name of the original object.
111
     *
112
     * @return string The name of the original object
113
     */
114 1
    public function __getClassName()
115
    {
116 1
        return get_class($this->sessionBean);
117
    }
118
119
    /**
120
     * Invokes the local execution of the passed remote method.
121
     *
122
     * @param string $method The local method to call
123
     * @param array  $params The parameters for the method call
124
     *
125
     * @return mixed The result of the local method call
126
     */
127 1
    public function __call($method, $params)
128
    {
129
130
        // invoke the method on the session bean
131 1
        $response = call_user_func_array(array($this->sessionBean, $method), $params);
132
133
        // initialize the flag to mark the instance to be re-attached
134 1
        $attach = true;
135
136
        // query if we've stateful session bean
137 1
        if ($this->sessionBeanDescriptor instanceof StatefulSessionBeanDescriptorInterface) {
138
            // remove the SFSB instance if a remove method has been called
139
            if ($this->sessionBeanDescriptor->isRemoveMethod($methodName)) {
0 ignored issues
show
The variable $methodName does not exist. Did you mean $method?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
140
                $this->beanManager->removeStatefulSessionBean($sessionId, $this->sessionBeanDescriptor->getClassName());
0 ignored issues
show
The variable $sessionId does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
The method removeStatefulSessionBean() does not seem to exist on object<AppserverIo\Psr\E...s\BeanContextInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
141
                $attach = false;
142
            }
143
        }
144
145
        // re-attach the bean instance if necessary
146 1
        if ($attach === true && $this->sessionId) {
147 1
            $this->beanManager->attach($this->sessionBean, $this->sessionId);
0 ignored issues
show
The method attach() does not seem to exist on object<AppserverIo\Psr\E...s\BeanContextInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
148 1
        }
149
150
        // return the remote method call result
151 1
        return $response;
152
    }
153
}
154