Issues (41)

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/MenuServiceProvider.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
namespace Malezha\Menu;
4
5
use Illuminate\Contracts\Config\Repository;
6
use Illuminate\Contracts\Container\Container;
7
use Illuminate\Support\ServiceProvider;
8
use Malezha\Menu\Contracts\Attributes as AttributesContract;
9
use Malezha\Menu\Contracts\Builder as BuilderContract;
10
use Malezha\Menu\Contracts\ComparativeUrl as ComparativeUrlContract;
11
use Malezha\Menu\Contracts\FromArrayBuilder as FromArrayBuilderContract;
12
use Malezha\Menu\Contracts\Menu as MenuContract;
13
use Malezha\Menu\Contracts\MenuRender;
14
use Malezha\Menu\Support\Attributes;
15
use Malezha\Menu\Support\ComparativeUrl;
16
use Malezha\Menu\Support\FromArrayBuilder;
17
18
/**
19
 * Class MenuServiceProvider
20
 * @package Malezha\Menu
21
 */
22
class MenuServiceProvider extends ServiceProvider
23
{
24
    /**
25
     * Indicates if loading of the provider is deferred.
26
     *
27
     * @var bool
28
     */
29
    protected $defer = false;
30
31
    /**
32
     * Bootstrap the application services.
33
     *
34
     * @return void
35
     */
36 53
    public function boot()
37
    {
38 53
        $this->loadViewsFrom(__DIR__ . '/../views', 'menu');
39
40 53
        $this->publishes([
41 53
            __DIR__ . '/../views' => base_path('resources/views/vendor/menu'),
42 53
            __DIR__ . '/../config/menu.php' => config_path('menu.php'),
43
        ]);
44 53
    }
45
46
    /**
47
     * Register the application services.
48
     *
49
     * @return void
50
     */
51 53
    public function register()
52
    {
53 53
        $this->mergeConfigFrom(__DIR__ . '/../config/menu.php', 'menu');
54
55 53
        $this->registerFromArrayBuilder();
56 53
        $this->registerComparativeUrl();
57 53
        $this->registerRenderSystem();
58 53
        $this->registerAttributes();
59 53
        $this->registerBuilder();
60 53
        $this->registerSingleton();
61 53
    }
62
63 53
    protected function registerSingleton()
64
    {
65
        $this->app->singleton('menu.instance', function(Container $app) {
66 8
            return new Menu($app);
67 53
        });
68 53
        $this->app->alias('menu.instance', MenuContract::class);
69 53
    }
70
71 53
    protected function registerBuilder()
72
    {
73 53
        $this->app->bind('menu.builder', Builder::class);
74 53
        $this->app->alias('menu.builder', BuilderContract::class);
75 53
    }
76
77 53
    protected function registerAttributes()
78
    {
79 53
        $this->app->bind('menu.attributes', Attributes::class);
80 53
        $this->app->alias('menu.attributes', AttributesContract::class);
81 53
    }
82
83 53
    protected function registerRenderSystem()
84
    {
85
        $this->app->bind('menu.render', function (Container $app) {
86 33
            $config = $app->make(Repository::class)->get('menu');
87 33
            $key = $config['default'];
88 33
            $available = $config['renders'];
89
90 33
            if (array_key_exists($key, $available)) {
91 33
                return new $available[$key]($app);
92
            }
93
94
            throw new \Exception('Can use template system: ' . $config['default']);
95 53
        });
96 53
        $this->app->alias('menu.render', MenuRender::class);
97 53
    }
98
99 53
    protected function registerComparativeUrl()
100
    {
101
        $this->app->singleton('menu.compare-url', function (Container $app) {
102 22
            return $app->make(ComparativeUrl::class, [
0 ignored issues
show
The call to Container::make() has too many arguments starting with array('skippedPaths' => ...t('menu.skippedPaths')).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
103 22
                'skippedPaths' => $app->make(Repository::class)->get('menu.skippedPaths'),
104
            ]);
105 53
        });
106 53
        $this->app->alias('menu.compare-url', ComparativeUrlContract::class);
107 53
    }
108
109
    protected function registerFromArrayBuilder()
110
    {
111 53
        $this->app->singleton('menu.from-array-builder', function (Container $app) {
112 53
            return $app->make(FromArrayBuilder::class);
113 53
        });
114 53
        $this->app->alias('menu.from-array-builder', FromArrayBuilderContract::class);
115
116 53
        FromArrayBuilder::setInstance($this->app->make(FromArrayBuilderContract::class));
117 53
    }
118
119
    /**
120
     * Get the services provided by the provider.
121
     *
122
     * @return array
123
     */
124
    public function provides()
125
    {
126
        return [];
127
    }
128
}
129