Issues (17)

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/Client/Node.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 Phloppy\Client;
3
4
use Iterator;
5
use Phloppy\Client\Node\JScanIterator;
6
use Phloppy\Exception\CommandException;
7
use Phloppy\NodeInfo;
8
9
/**
10
 * Disque commands for local nodes.
11
 */
12
class Node extends AbstractClient {
13
14
    /**
15
     * Authenticate against a Disque node.
16
     *
17
     * @param $password
18
     * @return boolean true if authenticated. False otherwise.
19
     *
20
     * @throws CommandException
21
     */
22 2
    public function auth($password)
0 ignored issues
show
function auth() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
23
    {
24 2
        $rsp = $this->send(['AUTH', $password]);
25 1
        return $rsp === 'OK';
26
    }
27
28
29
    /**
30
     * Send a ping command to the connected server.
31
     *
32
     * @return boolean True if the ping is acknowleged. False otherwise.
33
     */
34 2
    public function ping()
0 ignored issues
show
function ping() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
35
    {
36 2
        return $this->send(['PING']) === 'PONG';
37
    }
38
39
40
    /**
41
     * @return array
42
     */
43 1
    public function info()
44
    {
45 1
        $rsp      = $this->send(['INFO']);
46 1
        $info     = [];
47 1
        $sections = preg_split('/^#/m', $rsp);
48
49 1
        foreach ($sections as $section) {
50 1
            $lines  = explode("\r\n", trim($section));
51 1
            $header = trim($lines[0]);
52
53 1
            array_shift($lines);
54
55 1
            $lines = array_reduce($lines, function($c, $e) {
56 1
                list($k, $v) = explode(':', $e);
57 1
                $c[$k]       = $v;
58
59 1
                return $c;
60 1
            }, []);
61
62 1
            $info[$header] = $lines;
63 1
        }
64
65 1
        return $info;
66
    }
67
68
69
    /**
70
     * @return NodeInfo[]
71
     */
72 2
    public function hello()
73
    {
74 2
        $nodes    = [];
75 2
        $response = $this->send(['HELLO']);
76 2
        $version  = array_shift($response);
77
78
        switch ($version) {
79 2
            case 1:
80
                // active node id
81 2
                array_shift($response);
82
83
                // in single node mode the server may not have
84
                // determinded its own IP address, so we just use the
85
                // node url that we used to connect.
86 2
                if (count($response === 1) && $response[0][1] === '') {
87 2
                    $host           = parse_url($this->stream->getNodeUrl(), PHP_URL_HOST);
88 2
                    $response[0][1] = $host;
89 2
                }
90
91 2
                foreach ($response as $node) {
92 2
                    $server  = 'tcp://'.$node[1].':'.$node[2];
93 2
                    $nodes[] = new NodeInfo($node[0], $server, $node[3]);
94 2
                }
95
96 2
                break;
97
        }
98
99 2
        return $nodes;
100
    }
101
102
103
    /**
104
     * DELETE jobs from the connected node.
105
     *
106
     * @param string[] $jobs Job IDs to delete.
107
     *
108
     * @return int Number of jobs deleted
109
     */
110 3
    public function del(array $jobs)
111
    {
112
        try {
113 3
            return (int) $this->send(array_merge(['DELJOB'], $jobs));
114 1
        } catch (CommandException $e) {
115 1
            return 0;
116
        }
117
118
    }
119
120
121
    /**
122
     * Retrieve an Iterator over available jobs on the connected Disque node.
123
     *
124
     * @param int        $count
125
     * @param array      $queues
126
     * @param array      $states
127
     * @param            $format
128
     *
129
     * @return Iterator
0 ignored issues
show
Consider making the return type a bit more specific; maybe use JScanIterator.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
130
     * @see https://github.com/antirez/disque#jscan-cursor-count-count-busyloop-queue-queue-state-state1-state-state2--state-staten-reply-allid
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 143 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
131
     */
132 1
    public function jscan($count = 50, array $queues = [], array $states = [], $format = JScanIterator::FORMAT_ID)
133
    {
134 1
        $iterator = new JScanIterator($this->stream, $this->log);
135 1
        $iterator->setCount($count);
136 1
        $iterator->setQueues($queues);
137 1
        $iterator->setStates($states);
138 1
        $iterator->setFormat($format);
139
140 1
        return $iterator;
141
    }
142
}
143