Issues (13)

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

Languages
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
/*
4
 * This file is part of Laravel LogViewer.
5
 *
6
 * (c) Koss Shtukert <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace KossShtukert\LogViewer;
13
14
use Illuminate\Routing\Router;
15
use Illuminate\Support\ServiceProvider;
16
use KossShtukert\LogViewer\Http\Controllers\LogViewerController;
17
use KossShtukert\LogViewer\Log\Data;
18
use KossShtukert\LogViewer\Log\Factory;
19
use KossShtukert\LogViewer\Log\Filesystem;
20
21
/**
22
 * This is the log viewer service provider class.
23
 *
24
 * @author Koss Shtukert <[email protected]>
25
 */
26
class LogViewerServiceProvider extends ServiceProvider
27
{
28
    /**
29
     * Boot the service provider.
30
     *
31
     * @return void
32
     */
33 10
    public function boot()
34
    {
35 10
        $this->setupPackage();
36
37 10
        $this->setupRoutes($this->app->router);
0 ignored issues
show
Accessing router on the interface Illuminate\Contracts\Foundation\Application suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
38 10
    }
39
40
    /**
41
     * Setup the package.
42
     *
43
     * @return void
44
     */
45 10
    protected function setupPackage()
46
    {
47 10
        $source = realpath(__DIR__ . '/../config/logviewer.php');
48
49 10
        $this->publishes([$source => config_path('logviewer.php')], 'config');
50 10
        $this->publishes([
51 10
            realpath(__DIR__ . '/../assets/css') => public_path('assets/styles'),
52 10
            realpath(__DIR__ . '/../assets/js')  => public_path('assets/scripts'),
53 10
        ], 'public');
54
55 10
        $this->mergeConfigFrom($source, 'logviewer');
56
57 10
        $this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'logviewer');
58 10
    }
59
60
    /**
61
     * Setup the routes.
62
     *
63
     * @param \Illuminate\Routing\Router $router
64
     *
65
     * @return void
66
     */
67 10
    protected function setupRoutes(Router $router)
68
    {
69
        $router->group(['namespace' => 'KossShtukert\LogViewer\Http\Controllers'], function (Router $router) {
70 10
            require __DIR__ . '/Http/routes.php';
71 10
        });
72 10
    }
73
74
    /**
75
     * Register the service provider.
76
     *
77
     * @return void
78
     */
79 10
    public function register()
80
    {
81 10
        $this->registerLogData();
82 10
        $this->registerLogFilesystem();
83 10
        $this->registerLogFactory();
84
85 10
        $this->registerLogViewer();
86
87 10
        $this->registerLogViewerController();
88 10
    }
89
90
    /**
91
     * Register the log data class.
92
     *
93
     * @return void
94
     */
95 10
    protected function registerLogData()
96
    {
97
        $this->app->singleton('logviewer.data', function () {
98 4
            return new Data();
99 10
        });
100
101 10
        $this->app->alias('logviewer.data', Data::class);
102 10
    }
103
104
    /**
105
     * Register the log filesystem class.
106
     *
107
     * @return void
108
     */
109 10
    protected function registerLogFilesystem()
110
    {
111
        $this->app->singleton('logviewer.filesystem', function ($app) {
112 4
            $files = $app['files'];
113 4
            $path = $app['path.storage'] . '/logs';
114
115 4
            return new Filesystem($files, $path);
116 10
        });
117
118 10
        $this->app->alias('logviewer.filesystem', Filesystem::class);
119 10
    }
120
121
    /**
122
     * Register the log factory class.
123
     *
124
     * @return void
125
     */
126 10
    protected function registerLogFactory()
127
    {
128
        $this->app->singleton('logviewer.factory', function ($app) {
129 3
            $filesystem = $app['logviewer.filesystem'];
130 3
            $levels = $app['logviewer.data']->levels();
131
132 3
            return new Factory($filesystem, $levels);
133 10
        });
134
135 10
        $this->app->alias('logviewer.factory', Factory::class);
136 10
    }
137
138
    /**
139
     * Register the log data class.
140
     *
141
     * @return void
142
     */
143 10
    protected function registerLogViewer()
144
    {
145
        $this->app->singleton('logviewer', function ($app) {
146 2
            $factory = $app['logviewer.factory'];
147 2
            $filesystem = $app['logviewer.filesystem'];
148 2
            $data = $app['logviewer.data'];
149
150 2
            return new LogViewer($factory, $filesystem, $data);
151 10
        });
152
153 10
        $this->app->alias('logviewer', LogViewer::class);
154 10
    }
155
156
    /**
157
     * Register the log viewer controller class.
158
     *
159
     * @return void
160
     */
161
    protected function registerLogViewerController()
162
    {
163 10
        $this->app->bind(LogViewerController::class, function ($app) {
164
            $perPage = $app['config']['logviewer.per_page'];
165
            $middleware = $app['config']['logviewer.middleware'];
166
167
            return new LogViewerController($perPage, $middleware);
168 10
        });
169 10
    }
170
171
    /**
172
     * Get the services provided by the provider.
173
     *
174
     * @return string[]
175
     */
176 2
    public function provides()
177
    {
178
        return [
179 2
            'logviewer',
180 2
            'logviewer.data',
181 2
            'logviewer.factory',
182 2
            'logviewer.filesystem',
183 2
        ];
184
    }
185
}
186