Issues (12)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Providers/ServiceProvider.php (3 issues)

1
<?php
2
namespace NeedleProject\LaravelRabbitMq\Providers;
3
4
use Illuminate\Foundation\Application;
5
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
6
use NeedleProject\LaravelRabbitMq\Builder\ContainerBuilder;
7
use NeedleProject\LaravelRabbitMq\Command\BaseConsumerCommand;
8
use NeedleProject\LaravelRabbitMq\Command\BasePublisherCommand;
9
use NeedleProject\LaravelRabbitMq\Command\DeleteAllCommand;
10
use NeedleProject\LaravelRabbitMq\Command\SetupCommand;
11
use NeedleProject\LaravelRabbitMq\Command\ListEntitiesCommand;
12
use NeedleProject\LaravelRabbitMq\ConfigHelper;
13
use NeedleProject\LaravelRabbitMq\ConsumerInterface;
14
use NeedleProject\LaravelRabbitMq\Container;
15
use NeedleProject\LaravelRabbitMq\Exception\LaravelRabbitMqException;
16
use NeedleProject\LaravelRabbitMq\PublisherInterface;
17
use Psr\Log\LoggerAwareInterface;
18
use Psr\Log\LoggerInterface;
19
20
/**
21
 * Class ServiceProvider
22
 *
23
 * @package NeedleProject\LaravelRabbitMq\Providers
24
 * @author  Adrian Tilita <[email protected]>
25
 */
26
class ServiceProvider extends LaravelServiceProvider
27
{
28
    /**
29
     * Indicates if loading of the provider is deferred.
30
     *
31
     * @var bool
32
     */
33
    protected $defer = false;
34
35
    /**
36
     * Register services.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
        $this->registerContainer();
43
        $this->registerPublishers();
44
        $this->registerConsumers();
45
    }
46
47
    /**
48
     * Perform post-registration booting of services.
49
     *
50
     * @return void
51
     */
52
    public function boot()
53
    {
54
        $this->publishConfig();
55
        $this->registerCommands();
56
    }
57
58
    /**
59
     * Publish Config
60
     */
61
    private function publishConfig()
62
    {
63
        $this->publishes([
0 ignored issues
show
The method publishes() does not exist on NeedleProject\LaravelRab...oviders\ServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
        $this->/** @scrutinizer ignore-call */ 
64
               publishes([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
64
            realpath(
65
                dirname(__FILE__)
66
            ) . '/../../config/laravel_rabbitmq.php' => config_path('laravel_rabbitmq.php'),
67
        ]);
68
    }
69
70
    /**
71
     * Create container and register binding
72
     */
73
    private function registerContainer()
74
    {
75
        $config = config('laravel_rabbitmq', []);
76
        if (!is_array($config)) {
77
            throw new \RuntimeException(
78
                "Invalid configuration provided for LaravelRabbitMQ!"
79
            );
80
        }
81
        $configHelper = new ConfigHelper();
82
        $config = $configHelper->addDefaults($config);
83
84
        $this->app->singleton(
0 ignored issues
show
The method singleton() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

84
        $this->app->/** @scrutinizer ignore-call */ 
85
                    singleton(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
85
            Container::class,
86
            function () use ($config) {
87
                $container = new ContainerBuilder();
88
                return $container->createContainer($config);
89
            }
90
        );
91
    }
92
93
    /**
94
     * Register publisher bindings
95
     */
96
    private function registerPublishers()
97
    {
98
        // Get "tagged" like Publisher
99
        $this->app->singleton(PublisherInterface::class, function ($application, $arguments) {
100
            /** @var Container $container */
101
            $container = $application->make(Container::class);
102
            if (empty($arguments)) {
103
                throw new \RuntimeException("Cannot make Publisher. No publisher identifier provided!");
104
            }
105
            $aliasName = $arguments[0];
106
            return $container->getPublisher($aliasName);
107
        });
108
    }
109
110
    /**
111
     * Register consumer bindings
112
     */
113
    private function registerConsumers()
114
    {
115
        // Get "tagged" like Consumers
116
        $this->app->singleton(ConsumerInterface::class, function ($application, $arguments) {
117
            /** @var Container $container */
118
            $container = $application->make(Container::class);
119
            if (empty($arguments)) {
120
                throw new \RuntimeException("Cannot make Consumer. No consumer identifier provided!");
121
            }
122
            $aliasName = $arguments[0];
123
124
            if (!$container->hasConsumer($aliasName)) {
125
                throw new \RuntimeException("Cannot make Consumer.\nNo consumer with alias name {$aliasName} found!");
126
            }
127
            /** @var LoggerAwareInterface $consumer */
128
            $consumer = $container->getConsumer($aliasName);
129
            $consumer->setLogger($application->make(LoggerInterface::class));
130
            return $consumer;
131
        });
132
    }
133
134
    /**
135
     * Register commands
136
     */
137
    private function registerCommands()
138
    {
139
        $this->commands([
0 ignored issues
show
The method commands() does not exist on NeedleProject\LaravelRab...oviders\ServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

139
        $this->/** @scrutinizer ignore-call */ 
140
               commands([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
140
            SetupCommand::class,
141
            ListEntitiesCommand::class,
142
            BaseConsumerCommand::class,
143
            DeleteAllCommand::class,
144
            BasePublisherCommand::class
145
        ]);
146
    }
147
}
148