Issues (41)

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.

src/Channel/Router/RouterRule.php (1 issue)

Labels
Severity

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
namespace Dazzle\Channel\Router;
4
5
use Dazzle\Channel\Protocol\ProtocolInterface;
6
7
class RouterRule
8
{
9
    /**
10
     * @var RouterInterface
11
     */
12
    protected $router;
13
14
    /**
15
     * @var callable
16
     */
17
    protected $matcher;
18
19
    /**
20
     * @var callable
21
     */
22
    protected $handler;
23
24
    /**
25
     * @var bool
26
     */
27
    protected $propagate;
28
29
    /**
30
     * @var int
31
     */
32
    protected $limit;
33
34
    /**
35
     * @var array|null
36
     */
37
    protected $pointer;
38
39
    /**
40
     * @var bool
41
     */
42
    protected $cancelled;
43
44
    /**
45
     * @param RouterInterface $router
46
     * @param callable $matcher
47
     * @param callable $handler
48
     * @param bool $propagate
49
     * @param int $limit
50
     */
51 24
    public function __construct(RouterInterface $router, callable $matcher, callable $handler, $propagate = false, $limit = 0)
52
    {
53 24
        $this->router = $router;
54 24
        $this->matcher = $matcher;
55 24
        $this->handler = $handler;
56 24
        $this->propagate = $propagate;
57 24
        $this->limit = $limit;
58 24
        $this->pointer = null;
59 24
        $this->cancelled = false;
60 24
    }
61
62
    /**
63
     *
64
     */
65 10
    public function __destruct()
66
    {
67 10
        unset($this->router);
68 10
        unset($this->matcher);
69 10
        unset($this->handler);
70 10
        unset($this->propagate);
71 10
        unset($this->pointer);
72 10
        unset($this->cancelled);
73 10
    }
74
75
    /**
76
     * Return Router to which handler is attached to.
77
     *
78
     * @return RouterInterface
79
     */
80 1
    public function getRouter()
81
    {
82 1
        return $this->router;
83
    }
84
85
    /**
86
     * Match given message protocol.
87
     *
88
     * @param string $sender
89
     * @param ProtocolInterface $protocol
90
     * @return bool
91
     */
92 8
    public function match($sender, ProtocolInterface $protocol)
93
    {
94 8
        $callback = $this->matcher;
95 8
        return $callback($sender, $protocol);
96
    }
97
98
    /**
99
     * Handle given message protocol.
100
     *
101
     * @param string $sender
102
     * @param ProtocolInterface $protocol
103
     * @param int $flags
104
     * @param callable|null $success
105
     * @param callable|null $failure
106
     * @param callable|null $cancel
107
     * @param float $timeout
108
     * @return bool
109
     */
110 12
    public function handle($sender, ProtocolInterface $protocol, $flags, callable $success = null, callable $failure = null, callable $cancel = null, $timeout = 0.0)
111
    {
112 12
        $callback = $this->handler;
113 12
        $callback($sender, $protocol, $flags, $success, $failure, $cancel, $timeout);
114
115 12
        if ($this->limit > 0)
116
        {
117 2
            $this->limit--;
118 2
            if ($this->limit === 0)
119
            {
120 1
                $this->cancel();
121
            }
122
        }
123
124 12
        return $this->propagate;
125
    }
126
127
    /**
128
     * Remove this handler.
129
     */
130
    public function cancel()
131
    {
132
        if (isset($this->pointer) && isset($this->router) && !$this->cancelled)
133
        {
134
            $this->router->removeHandler($this->pointer[0], $this->pointer[1]);
0 ignored issues
show
The method removeHandler() does not exist on Dazzle\Channel\Router\RouterInterface. Did you maybe mean handle()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
135
            $this->cancelled = true;
136
        }
137
    }
138
139
    /**
140
     * @internal
141
     * @param string $stack
142
     * @param int $pointer
143
     */
144 16
    public function setPointer($stack, $pointer)
145
    {
146 16
        $this->pointer = [ $stack, $pointer ];
147 16
    }
148
}
149