Issues (34)

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/Laravel/ServiceProvider.php (5 issues)

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 namespace Sofa\Revisionable\Laravel;
2
3
use Illuminate\Support\ServiceProvider as BaseProvider;
4
use ReflectionClass;
5
6
/**
7
 * @method void publishes(array $paths, $group = null)
8
 */
9
class ServiceProvider extends BaseProvider
10
{
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = false;
17
18
    /**
19
     * Bootstrap any application services.
20
     *
21
     * @return void
22
     */
23
    public function boot()
24
    {
25
        $this->publishes([
26
            $this->guessPackagePath() . '/config/config.php' => config_path('sofa_revisionable.php'),
27
            $this->guessPackagePath() . '/migrations/' => base_path('/database/migrations'),
28
        ]);
29
    }
30
31
    /**
32
     * Register the service provider.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->bindLogger();
39
40
        $this->bindUserProvider();
41
42
        $this->bindListener();
43
44
        $this->bootModel();
45
    }
46
47
    /**
48
     * Bind Revisionable logger implementation to the IoC.
49
     *
50
     * @return void
51
     */
52
    protected function bindLogger()
53
    {
54
        $table = $this->app['config']->get('sofa_revisionable.table', 'revisions');
55
56
        $this->app->bindShared('revisionable.logger', function ($app) use ($table) {
0 ignored issues
show
The method bindShared() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
57
            return new \Sofa\Revisionable\Laravel\DbLogger($app['db']->connection(), $table);
58
        });
59
    }
60
61
    /**
62
     * Bind user provider implementation to the IoC.
63
     *
64
     * @return void
65
     */
66
    protected function bindUserProvider()
67
    {
68
        $userProvider = $this->app['config']->get('sofa_revisionable.userprovider');
69
70
        switch ($userProvider) {
71
            case 'sentry':
72
                $this->bindSentryProvider();
73
                break;
74
75
            case 'sentinel':
76
                $this->bindSentinelProvider();
77
                break;
78
79
            case 'jwt-auth':
80
                $this->bindJwtAuthProvider();
81
                break;
82
83
            default:
84
                $this->bindGuardProvider();
85
        }
86
    }
87
88
    /**
89
     * Bind adapter for Sentry to the IoC.
90
     *
91
     * @return void
92
     */
93
    protected function bindSentryProvider()
94
    {
95
        $this->app->bindShared('revisionable.userprovider', function ($app) {
0 ignored issues
show
The method bindShared() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
96
            $field = $app['config']->get('sofa_revisionable.userfield');
97
98
            return new \Sofa\Revisionable\Adapters\Sentry($app['sentry'], $field);
99
        });
100
    }
101
102
    /**
103
     * Bind adapter for Sentinel to the IoC.
104
     *
105
     * @return void
106
     */
107
    protected function bindSentinelProvider()
108
    {
109
        $this->app->bindShared('revisionable.userprovider', function ($app) {
0 ignored issues
show
The method bindShared() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
110
            $field = $app['config']->get('sofa_revisionable.userfield');
111
112
            return new \Sofa\Revisionable\Adapters\Sentinel($app['sentinel'], $field);
113
        });
114
    }
115
116
    /**
117
     * Bind adapter for JWT Auth to the IoC.
118
     *
119
     * @return void
120
     */
121
    private function bindJwtAuthProvider()
122
    {
123
        $this->app->bindShared('revisionable.userprovider', function ($app) {
0 ignored issues
show
The method bindShared() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
124
            $field = $app['config']->get('sofa_revisionable.userfield');
125
126
            return new \Sofa\Revisionable\Adapters\JwtAuth($app['tymon.jwt.auth'], $field);
127
        });
128
    }
129
130
    /**
131
     * Bind adapter for Illuminate Guard to the IoC.
132
     *
133
     * @return void
134
     */
135
    protected function bindGuardProvider()
136
    {
137
        $this->app->bindShared('revisionable.userprovider', function ($app) {
0 ignored issues
show
The method bindShared() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
138
            $field = $app['config']->get('sofa_revisionable.userfield');
139
140
            return new \Sofa\Revisionable\Adapters\Guard($app['auth']->driver(), $field);
141
        });
142
    }
143
144
    /**
145
     * Bind listener implementation to the Ioc.
146
     *
147
     * @return void
148
     */
149
    protected function bindListener()
150
    {
151
        $this->app->bind('Sofa\Revisionable\Listener', function ($app) {
152
            return new \Sofa\Revisionable\Laravel\Listener($app['revisionable.userprovider']);
153
        });
154
    }
155
156
    /**
157
     * Boot the Revision model.
158
     *
159
     * @return void
160
     */
161
    protected function bootModel()
162
    {
163
        $table = $this->app['config']->get('sofa_revisionable.table', 'revisions');
164
165
        forward_static_call_array(['\Sofa\Revisionable\Laravel\Revision', 'setCustomTable'], [$table]);
166
    }
167
168
    /**
169
     * Get the services provided by the provider.
170
     *
171
     * @return string[]
172
     */
173
    public function provides()
174
    {
175
        return [
176
            'revisionable.logger',
177
            'revisionable.userprovider',
178
        ];
179
    }
180
181
    /**
182
     * Guess real path of the package.
183
     *
184
     * @return string
185
     */
186
    public function guessPackagePath()
187
    {
188
        $path = (new ReflectionClass($this))->getFileName();
189
190
        return realpath(dirname($path).'/../');
191
    }
192
}
193