GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (29)

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/Driver/Amqp/Driver.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 Bernard\Driver\Amqp;
4
5
use PhpAmqpLib\Channel\AMQPChannel;
6
use PhpAmqpLib\Connection\AbstractConnection;
7
use PhpAmqpLib\Message\AMQPMessage;
8
9
final class Driver implements \Bernard\Driver
10
{
11
    /**
12
     * @var AbstractConnection
13
     */
14
    private $connection;
15
16
    /**
17
     * @var AMQPChannel
18
     */
19
    private $channel;
20
21
    /**
22
     * @var string
23
     */
24
    private $exchange;
25
26
    /**
27
     * @var array|null
28
     */
29
    private $defaultMessageParams;
30
31
    /**
32
     * @param AbstractConnection $connection
33
     * @param string             $exchange
34
     * @param array              $defaultMessageParams
35
     */
36 7
    public function __construct(AbstractConnection $connection, $exchange, array $defaultMessageParams = null)
37
    {
38 7
        $this->connection = $connection;
39 7
        $this->exchange = $exchange;
40 7
        $this->defaultMessageParams = $defaultMessageParams;
41 7
    }
42
43
    /**
44
     * Returns a list of all queue names.
45
     *
46
     * @return array
47
     */
48
    public function listQueues()
49
    {
50
    }
51
52
    /**
53
     * Create a queue.
54
     *
55
     * @param string $queueName
56
     */
57 1
    public function createQueue($queueName)
58
    {
59 1
        $channel = $this->getChannel();
60 1
        $channel->exchange_declare($this->exchange, 'direct', false, true, false);
61 1
        $channel->queue_declare($queueName, false, true, false, false);
62 1
        $channel->queue_bind($queueName, $this->exchange, $queueName);
63 1
    }
64
65
    /**
66
     * Count the number of messages in queue. This can be a approximately number.
67
     *
68
     * @param string $queueName
69
     *
70
     * @return int
71
     */
72
    public function countMessages($queueName)
73
    {
74
        list(, $messageCount) = $this->getChannel()->queue_declare($queueName, true);
75
76
        return $messageCount;
77
    }
78
79
    /**
80
     * Insert a message at the top of the queue.
81
     *
82
     * @param string $queueName
83
     * @param string $message
84
     */
85 2
    public function pushMessage($queueName, $message)
86
    {
87 2
        $amqpMessage = new AMQPMessage($message, $this->defaultMessageParams);
0 ignored issues
show
It seems like $this->defaultMessageParams can also be of type null; however, PhpAmqpLib\Message\AMQPMessage::__construct() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
88 2
        $this->getChannel()->basic_publish($amqpMessage, $this->exchange, $queueName);
89 2
    }
90
91
    /**
92
     * Remove the next message in line. And if no message is available
93
     * wait $duration seconds.
94
     *
95
     * @param string $queueName
96
     * @param int    $duration
97
     *
98
     * @return array An array like array($message, $receipt);
99
     */
100 2
    public function popMessage($queueName, $duration = 5)
101
    {
102 2
        $runtime = microtime(true) + $duration;
103
104 2
        while (microtime(true) < $runtime) {
105 2
            $message = $this->getChannel()->basic_get($queueName);
106
107 2
            if ($message) {
108 1
                return [$message->body, $message->get('delivery_tag')];
109
            }
110
111
            // sleep for 10 ms to prevent hammering CPU
112 1
            usleep(10000);
113 1
        }
114
115 1
        return [null, null];
116
    }
117
118
    /**
119
     * If the driver supports it, this will be called when a message
120
     * have been consumed.
121
     *
122
     * @param string $queueName
123
     * @param mixed  $receipt
124
     */
125 1
    public function acknowledgeMessage($queueName, $receipt)
126
    {
127 1
        $this->getChannel()->basic_ack($receipt);
128 1
    }
129
130
    /**
131
     * Returns a $limit numbers of messages without removing them
132
     * from the queue.
133
     *
134
     * @param string $queueName
135
     * @param int    $index
136
     * @param int    $limit
137
     */
138
    public function peekQueue($queueName, $index = 0, $limit = 20)
139
    {
140
    }
141
142
    /**
143
     * Removes the queue.
144
     *
145
     * @param string $queueName
146
     */
147
    public function removeQueue($queueName)
148
    {
149
        $this->getChannel()->queue_delete($queueName);
150
    }
151
152
    /**
153
     * @return array
154
     */
155
    public function info()
156
    {
157
    }
158
159 1
    public function __destruct()
160
    {
161 1
        if (null !== $this->channel) {
162
            $this->channel->close();
163
        }
164 1
    }
165
166 6
    private function getChannel()
167
    {
168 6
        if (null === $this->channel) {
169 6
            $this->channel = $this->connection->channel();
170 6
        }
171
172 6
        return $this->channel;
173
    }
174
}
175