Issues (10)

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.

lib/PhpFlo/Component/Queue.php (2 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
/*
3
 * This file is part of the phpflo/phpflo package.
4
 *
5
 * (c) Henri Bergius <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace PhpFlo\Component;
12
13
use PhpFlo\Component;
14
15
/**
16
 * Component for creating a simple queue of messages.
17
 *
18
 * All incomming messages are kept in memory. As soon as the queue reaches the
19
 * pre-configured size of 100 messages, the current list of messages is send.
20
 *
21
 * You can reconfigure the queue size of the component by sending a message to
22
 * the `size` input port of this component. If the incomming data is not a
23
 * positive integer, an error message will be send to the `err` out port of this
24
 * component.
25
 *
26
 * @author Marijn Huizendveld <[email protected]>
27
 */
28
class Queue extends Component
29
{
30
    /**
31
     * @var integer
32
     */
33
    private $size;
34
35
    /**
36
     * @var array<mixed>
37
     */
38
    private $messages;
39
40
    public function __construct()
41
    {
42
        $this->size = 100;
43
        $this->messages = [];
44
45
        $this->inPorts()
46
            ->add('in', ['datatype' => 'all'])
47
            ->add('size', ['datatype' => 'all']);
48
49
        $this->outPorts()
50
            ->add('error', ['datatype' => 'all'])
51
            ->add('messages', ['datatype' => 'all']);
52
53
        $this->inPorts()->in->on('data', [$this, 'onAppendQueue']);
54
        $this->inPorts()->in->on('detach', [$this, 'onStreamEnded']);
55
56
        $this->inPorts()->size->on('data', [$this, 'onResize']);
57
    }
58
59
    /**
60
     * @param mixed $data
61
     */
62
    public function onAppendQueue($data)
63
    {
64
        $this->messages[] = $data;
65
66
        $this->sendQueue();
67
    }
68
69
    public function onStreamEnded()
70
    {
71
        $this->flushQueue();
72
    }
73
74
    /**
75
     * @param mixed $data
76
     */
77
    public function onResize($data)
78
    {
79
        if (!is_int($data) || 0 > $data) {
80
            $dumped = var_dump($data);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($data); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
Are you sure the assignment to $dumped is correct as var_dump($data) (which targets var_dump()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
81
82
            $this->outPorts()->error->send(
83
                "Invalid queue size: '{$dumped}'. Queue resize operation expects a positive integer value."
84
            );
85
        }
86
87
        $this->size = $data;
88
89
        $this->sendQueue();
90
    }
91
92
    private function sendQueue()
93
    {
94
        if ($this->size <= count($this->messages)) {
95
            $this->flushQueue();
96
        }
97
    }
98
99
    private function flushQueue()
100
    {
101
        $this->outPorts()
102
            ->messages
103
            ->send($this->messages)
104
            ->disconnect();
105
106
        $this->messages = [];
107
    }
108
}
109