Issues (1507)

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.

PHPDaemon/SockJS/WebSocketRouteProxy.php (5 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 PHPDaemon\SockJS;
3
4
use PHPDaemon\Core\Timer;
5
6
/**
7
 * @package    Libraries
8
 * @subpackage SockJS
9
 * @author     Vasily Zorin <[email protected]>
10
 */
11
class WebSocketRouteProxy implements \PHPDaemon\WebSocket\RouteInterface
12
{
13
    use \PHPDaemon\Traits\StaticObjectWatchdog;
14
15
    protected $heartbeatTimer;
16
17
    protected $realRoute;
18
19
    protected $sockjs;
20
21
    /**
22
     * __construct
23
     * @param Application $sockjs
24
     * @param object $conn
0 ignored issues
show
There is no parameter named $conn. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
25
     */
26
    public function __construct($sockjs, $route)
27
    {
28
        $this->sockjs = $sockjs;
29
        $this->realRoute = $route;
30
    }
31
32
    /**
33
     * __get
34
     * @param  string $k
35
     * @return mixed
36
     */
37
    public function &__get($k)
38
    {
39
        return $this->realRoute->{$k};
40
    }
41
42
    /**
43
     * __call
44
     * @param  string $method
45
     * @param  array $args
46
     * @return mixed
47
     */
48
    public function __call($method, $args)
49
    {
50
        $func = [$this->realRoute, $method];
51
        $func(...$args);
52
    }
53
54
    /**
55
     * Called when new frame received.
56
     * @param string $data Frame's contents.
57
     * @param integer $type Frame's type.
58
     * @return void
59
     */
60
    public function onFrame($data, $type)
61
    {
62
        foreach (explode("\n", $data) as $pct) {
63
            if ($pct === '') {
64
                continue;
65
            }
66
            $pct = json_decode($pct, true);
67
            if (isset($pct[0])) {
68
                foreach ($pct as $i) {
69
                    $this->onPacket(rtrim($i, "\n"), $type);
70
                }
71
            } else {
72
                $this->onPacket($pct, $type);
73
            }
74
        }
75
    }
76
77
    /**
78
     * onPacket
79
     * @param string $data Frame's contents.
0 ignored issues
show
There is no parameter named $data. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
80
     * @param integer $type Frame's type.
81
     * @return void
82
     */
83
    public function onPacket($frame, $type)
84
    {
85
        $this->realRoute->onFrame($frame, $type);
0 ignored issues
show
The method onFrame cannot be called on $this->realRoute (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
86
    }
87
88
    /**
89
     * realRoute onBeforeHandshake
90
     * @param  callable $cb
91
     * @return void|false
92
     */
93
    public function onBeforeHandshake($cb)
94
    {
95
        if (!method_exists($this->realRoute, 'onBeforeHandshake')) {
96
            return false;
97
        }
98
        $this->realRoute->onBeforeHandshake($cb);
0 ignored issues
show
The method onBeforeHandshake cannot be called on $this->realRoute (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
99
    }
100
101
    /**
102
     * @TODO DESCR
103
     * @return void
104
     */
105
    public function onHandshake()
106
    {
107
        $this->realRoute->client->sendFrameReal('o');
108
        if (($f = $this->sockjs->config->heartbeatinterval->value) > 0) {
109
            $this->heartbeatTimer = setTimeout(function ($timer) {
110
                $this->realRoute->client->sendFrameReal('h');
111
                $timer->timeout();
112
            }, $f * 1e6);
113
            $this->realRoute->onHandshake();
114
        }
115
    }
116
117
    /**
118
     * @TODO DESCR
119
     * @return void
120
     */
121
    public function onWrite()
122
    {
123
        if (method_exists($this->realRoute, 'onWrite')) {
124
            $this->realRoute->onWrite();
0 ignored issues
show
The method onWrite cannot be called on $this->realRoute (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
125
        }
126
    }
127
128
    /**
129
     * @TODO DESCR
130
     * @return void
131
     */
132
    public function onFinish()
133
    {
134
        Timer::remove($this->heartbeatTimer);
135
        if ($this->realRoute) {
136
            $this->realRoute->onFinish();
137
            $this->realRoute = null;
138
        }
139
    }
140
}
141