Issues (20)

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.

Adapter/Stomp/Stomp.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
3
namespace Kaliop\Queueing\Plugins\StompBundle\Adapter\Stomp;
4
5
/// @todo find a better name for this class
6
class Stomp
7
{
8
    protected $client;
9
    protected $username;
10
    protected $password;
11
    protected $stompQueueName;
12
    protected $connected = false;
13
14
    /**
15
     * @param array $connectionConfig keys:
16
     *                                - connect_string
17
     *                                - credentials (optional, must be an array with 'user' and 'password'
18
     */
19
    public function __construct(array $connectionConfig)
20
    {
21
        $connectString = $connectionConfig['connect_string'];
22
        $this->client = new Client($connectString);
23
        if (isset($connectionConfig['credentials'])) {
24
            $this->setCredentials($connectionConfig['credentials']['user'], $connectionConfig['credentials']['password']);
25
        }
26
    }
27
28
    public function __destruct()
29
    {
30
        if ($this->connected) {
31
            $this->client->disconnect();
32
        }
33
    }
34
35
    public function setCredentials($username, $password)
36
    {
37
        $this->username = $username;
38
        $this->password = $password;
39
40
        return $this;
41
    }
42
43
    /**
44
     * @param bool
45
     * @return Consumer
46
     */
47
    public function setDebug($debug)
48
    {
49
        $this->client->debug = $debug;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @param string $queueName NB: queue name as used by Stomp, including the prefix used by the broker to specify the
56
     *                          message delivery pattern
57
     * @return Producer
58
     */
59
    public function setStompQueueName($queueName)
60
    {
61
        $this->stompQueueName = $queueName;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return string the queue name as used by Stomp
68
     */
69
    public function getStompQueueName()
70
    {
71
        return $this->setompQueueName;
0 ignored issues
show
The property setompQueueName does not seem to exist. Did you mean stompQueueName?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
72
    }
73
74
    /**
75
     * Returns the full queue name to be used in stomp messages.
76
     * - Apache Apollo supports using routing keys at end of queue name @see https://activemq.apache.org/apollo/documentation/stomp-manual.html#Destination_Wildcards
77
     * - ActiveMQ: @see http://activemq.apache.org/wildcards.html
78
     * - RabbitMQ: @see https://www.rabbitmq.com/stomp.html
79
     * - Artemis: @see https://activemq.apache.org/components/artemis/documentation/latest/stomp.html
80
     *
81
     * @param string $routingKey assumes the amqp pattern: *=1word, #=0-or-more
82
     * @return string;
0 ignored issues
show
The doc-type string; could not be parsed: Expected "|" or "end of type", but got ";" at position 6. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
83
     */
84
    protected function getFullQueueName($routingKey = '')
85
    {
86
        $queueName = $this->stompQueueName;
87
        if ($routingKey != '') {
88
            switch($this->client->brokerVendor) {
89 View Code Duplication
                case 'Apollo':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
90
                    $routingKey = str_replace('#', '**', $routingKey);
91
                    $queueName = rtrim($queueName, '.') . '.' . ltrim($routingKey, '.');
92
                    break;
93
                case 'AMQ':
94 View Code Duplication
                default:
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
95
                    $routingKey = str_replace('#', '>', $routingKey);
96
                    $queueName = rtrim($queueName, '.') . '.' . ltrim($routingKey, '.');
97
            }
98
        }
99
        return $queueName;
100
    }
101
102
    /**
103
     * Connects to the Stomp server. Attempts the connection only once by default, regardless of results
104
     *
105
     * @param bool $onlyOnce
106
     * @throws \FuseSource\Stomp\Exception\StompException
107
     */
108
    protected function connect($onlyOnce = true)
109
    {
110
        if ($onlyOnce && $this->connected) {
111
            return;
112
        }
113
        $this->client->connect($this->username, $this->password);
114
        $this->connected = true;
115
    }
116
117
}
118