Issues (34)

Security Analysis    not enabled

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/Provider/AbstractProvider.php (1 issue)

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
/**
4
 * Copyright 2014 Underground Elephant
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 *
18
 * @package     qpush-bundle
19
 * @copyright   Underground Elephant 2014
20
 * @license     Apache License, Version 2.0
21
 */
22
23
namespace Uecode\Bundle\QPushBundle\Provider;
24
25
use Doctrine\Common\Cache\Cache;
26
use Monolog\Logger;
27
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
28
use Uecode\Bundle\QPushBundle\Event\MessageEvent;
29
use Uecode\Bundle\QPushBundle\Event\NotificationEvent;
30
31
/**
32
 * @author Keith Kirk <[email protected]>
33
 */
34
abstract class AbstractProvider implements ProviderInterface
35
{
36
    /**
37
     * QPush Queue Name
38
     *
39
     * @var string
40
     */
41
    protected $name;
42
43
    /**
44
     * QPush Queue Options
45
     *
46
     * @var array
47
     */
48
    protected $options;
49
50
    /**
51
     * Doctrine APC Cache Driver
52
     *
53
     * @var Cache
54
     */
55
    protected $cache;
56
57
    /**
58
     * Monolog Logger
59
     *
60
     * @var Logger
61
     */
62
    protected $logger;
63
64
    /**
65
     * {@inheritDoc}
66
     */
67 3
    public function getName()
68
    {
69 3
        return $this->name;
70
    }
71
72
    /**
73
     * {@inheritDoc}
74
     */
75 17
    public function getNameWithPrefix()
76
    {
77 17
        if (!empty($this->options['queue_name'])) {
78 1
            return $this->options['queue_name'];
79
        }
80
81 16
        return sprintf("%s_%s", self::QPUSH_PREFIX, $this->name);
82
    }
83
84
    /**
85
     * {@inheritDoc}
86
     */
87 1
    public function getOptions()
88
    {
89 1
        return $this->options;
90
    }
91
92
    /**
93
     * {@inheritDoc}
94
     */
95 1
    public function getCache()
96
    {
97 1
        return $this->cache;
98
    }
99
100
    /**
101
     * {@inheritDoc}
102
     */
103 1
    public function getlogger()
104
    {
105 1
        return $this->logger;
106
    }
107
108
    /**
109
     * {@inheritDoc}
110
     */
111 20
    public function log($level, $message, array $context = [])
112
    {
113 20
        if (!$this->options['logging_enabled']) {
114 20
            return false;
115
        }
116
117
        // Add the queue name and provider to the context
118 1
        $context = array_merge(['queue' => $this->name, 'provider'  => $this->getProvider()], $context);
119
120 1
        return $this->logger->addRecord($level, $message, $context);
121
    }
122
123
    /**
124
     * @param NotificationEvent $event
125
     * @param string $eventName Name of the event
126
     * @param EventDispatcherInterface $dispatcher
127
     * @return bool
128
     */
129 1
    public function onNotification(NotificationEvent $event, $eventName, EventDispatcherInterface $dispatcher)
0 ignored issues
show
The parameter $eventName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
130
    {
131 1
        return false;
132
    }
133
134
    /**
135
     * @param MessageEvent $event
136
     * @return bool
137
     */
138 1
    public function onMessageReceived(MessageEvent $event)
139
    {
140 1
        return false;
141
    }
142
143
    /**
144
     * Merge override options while restricting what keys are allowed
145
     *
146
     * @param  array $options An array of options that override the queue defaults
147
     *
148
     * @return array
149
     */
150 7
    public function mergeOptions(array $options = [])
151
    {
152 7
        return array_merge($this->options, array_intersect_key($options, $this->options));
153
    }
154
155
    abstract public function getProvider();
156
157
    abstract public function create();
158
159
    abstract public function publish(array $message, array $options = []);
160
161
    abstract public function receive(array $options = []);
162
163
    abstract public function delete($id);
164
165
    abstract public function destroy();
166
}
167