This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 Audit; |
||
4 | |||
5 | use Audit\Http\Middleware\Audits; |
||
6 | use Illuminate\Foundation\AliasLoader; |
||
7 | use Illuminate\Routing\Router; |
||
8 | use Illuminate\Support\Collection; |
||
9 | use Illuminate\Support\Facades\App; |
||
10 | use Illuminate\Support\Facades\Schema; |
||
11 | use Illuminate\Support\Facades\View; |
||
12 | use Illuminate\Support\ServiceProvider; |
||
13 | use Muleta\Traits\Providers\ConsoleTools; |
||
14 | use Route; |
||
15 | |||
16 | class AuditProvider extends ServiceProvider |
||
17 | { |
||
18 | use ConsoleTools; |
||
19 | |||
20 | public $packageName = 'audit'; |
||
21 | const pathVendor = 'sierratecnologia/audit'; |
||
22 | |||
23 | // @todo Usar Tools aqui pro providers |
||
24 | /** |
||
25 | * This namespace is applied to the controller routes in your routes file. |
||
26 | * |
||
27 | * In addition, it is set as the URL generator's root namespace. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $namespace = 'Audit\Http\Controllers'; |
||
32 | |||
33 | public static $aliasProviders = [ |
||
34 | |||
35 | ]; |
||
36 | |||
37 | public static $providers = [ |
||
38 | /** |
||
39 | * Configuracoes |
||
40 | */ |
||
41 | \Audit\Providers\TelescopeServiceProvider::class, |
||
42 | |||
43 | /** |
||
44 | * Externos |
||
45 | */ |
||
46 | \Laravel\Telescope\TelescopeServiceProvider::class, |
||
47 | \Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class, |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * Rotas do Menu |
||
52 | */ |
||
53 | public static $menuItens = [ |
||
54 | [ |
||
55 | 'text' => 'Auditoria', |
||
56 | 'icon' => 'fas fa-fw fa-chart-area', |
||
57 | 'icon_color' => "blue", |
||
58 | 'label_color' => "success", |
||
59 | 'order' => 4550, |
||
60 | 'section' => "rica", |
||
61 | 'level' => 2, // 0 (Public), 1, 2 (Admin) , 3 (Root) |
||
62 | ], |
||
63 | 'Auditoria' => [ |
||
64 | [ |
||
65 | 'text' => 'Logs', |
||
66 | 'route' => 'rica.tracking.larametrics::metrics.index', |
||
67 | 'icon' => 'dashboard', |
||
68 | 'icon_color' => 'blue', |
||
69 | 'label_color' => 'success', |
||
70 | 'level' => 2, |
||
71 | 'order' => 4550, |
||
72 | 'section' => "admin", |
||
73 | // 'access' => \Porteiro\Models\Role::$ADMIN |
||
74 | ], |
||
75 | [ |
||
76 | 'text' => 'Telescope', |
||
77 | 'route' => 'telescope', |
||
78 | 'icon' => 'dashboard', |
||
79 | 'icon_color' => 'blue', |
||
80 | 'label_color' => 'success', |
||
81 | 'level' => 2, |
||
82 | 'order' => 4550, |
||
83 | 'section' => "rica", |
||
84 | // 'access' => \Porteiro\Models\Role::$ADMIN |
||
85 | ], |
||
86 | [ |
||
87 | 'text' => 'Horizon', |
||
88 | 'route' => 'horizon.index', |
||
89 | 'icon' => 'dashboard', |
||
90 | 'icon_color' => 'blue', |
||
91 | 'label_color' => 'success', |
||
92 | 'order' => 4550, |
||
93 | 'section' => "rica", |
||
94 | 'level' => 2, |
||
95 | // 'access' => \Porteiro\Models\Role::$ADMIN |
||
96 | ], |
||
97 | ], |
||
98 | ]; |
||
99 | |||
100 | /** |
||
101 | * Alias the services in the boot. |
||
102 | */ |
||
103 | public function boot(Router $router) |
||
104 | { |
||
105 | // Push middleware to web group |
||
106 | $router->pushMiddlewareToGroup('web', Audits::class); |
||
107 | |||
108 | // Register configs, migrations, etc |
||
109 | $this->registerDirectories(); |
||
110 | |||
111 | |||
112 | /** |
||
113 | * Transmissor; Routes |
||
114 | */ |
||
115 | $this->loadRoutesForRiCa(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'routes'); |
||
116 | |||
117 | |||
118 | // Log model change events after others in case they modified the record |
||
119 | // before being saved. |
||
120 | $this->app['events']->listen( |
||
121 | 'eloquent.*', |
||
122 | 'Audit\Observers\Changes' |
||
123 | ); |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * Register the services. |
||
128 | */ |
||
129 | public function register() |
||
130 | { |
||
131 | // Merge own configs into user configs |
||
132 | $this->mergeConfigFrom($this->getPublishesPath('config/application/modelagem.php'), 'sitec.audit'); |
||
133 | |||
134 | $this->mergeConfigFrom($this->getPublishesPath('config/activitylog.php'), 'activitylog'); |
||
135 | $this->mergeConfigFrom($this->getPublishesPath('config/logging.php'), 'logging'); |
||
136 | $this->mergeConfigFrom($this->getPublishesPath('config/logviewer.php'), 'logviewer'); |
||
137 | $this->mergeConfigFrom($this->getPublishesPath('config/telescope.php'), 'telescope'); |
||
138 | |||
139 | // Register external packages |
||
140 | $this->setProviders(); |
||
141 | $this->loadMigrationsFrom(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'migrations'); |
||
142 | |||
143 | // // Configs |
||
144 | // $this->app->config->set('Audit.modules.Audit', include(__DIR__.'/config.php')); |
||
145 | |||
146 | /* |
||
147 | |-------------------------------------------------------------------------- |
||
148 | | Register the Commands |
||
149 | |-------------------------------------------------------------------------- |
||
150 | */ |
||
151 | |||
152 | $this->commands([]); |
||
153 | } |
||
154 | |||
155 | |||
156 | /** |
||
157 | * Register configs, migrations, etc |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | public function registerDirectories() |
||
162 | { |
||
163 | // Publish config files |
||
164 | $this->publishes( |
||
165 | [ |
||
166 | // Paths |
||
167 | $this->getPublishesPath('config'.DIRECTORY_SEPARATOR.'sitec') => config_path('sitec'), |
||
168 | // Files |
||
169 | $this->getPublishesPath('config/activitylog.php') => config_path('activitylog.php'), |
||
170 | $this->getPublishesPath('config/logging.php') => config_path('logging.php'), |
||
171 | $this->getPublishesPath('config/logviewer.php') => config_path('logviewer.php'), |
||
172 | $this->getPublishesPath('config/telescope.php') => config_path('telescope.php') |
||
173 | ], |
||
174 | ['config', 'sitec', 'sitec-config'] |
||
175 | ); |
||
176 | |||
177 | // // Publish audit css and js to public directory |
||
178 | // $this->publishes([ |
||
179 | // $this->getDistPath() => public_path('assets/audit') |
||
180 | // ], 'assets'); |
||
181 | |||
182 | |||
183 | |||
184 | // Publish audit css and js to public directory |
||
185 | $this->publishes( |
||
186 | [ |
||
187 | $this->getPublishesPath('public/telescope') => public_path('vendor/telescope'), |
||
188 | ], |
||
189 | ['public', 'sitec', 'sitec-public'] |
||
190 | ); |
||
191 | |||
192 | |||
193 | $this->loadViews(); |
||
194 | $this->loadTranslations(); |
||
0 ignored issues
–
show
|
|||
195 | } |
||
196 | |||
197 | private function loadViews() |
||
198 | { |
||
199 | // View namespace |
||
200 | $viewsPath = $this->getResourcesPath('views'); |
||
201 | $this->loadViewsFrom($viewsPath, 'audit'); |
||
202 | $this->publishes( |
||
203 | [ |
||
204 | $viewsPath => base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'audit'), |
||
205 | $this->getPublishesPath('views/laravel-log-viewer') => base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'laravel-log-viewer'), |
||
206 | ], |
||
207 | ['views', 'sitec', 'sitec-views', 'ricasolucoes', 'ricasolucoes-views', 'audit-views'] |
||
208 | ); |
||
209 | |||
210 | |||
211 | // // Publish lanaguage files |
||
212 | // $this->publishes([ |
||
213 | // $this->getResourcesPath('lang') => resource_path('lang'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'audit') |
||
214 | // ], 'lang'); |
||
215 | |||
216 | // // Load translations |
||
217 | // $this->loadTranslationsFrom($this->getResourcesPath('lang'), 'audit'); |
||
218 | } |
||
219 | |||
220 | private function loadTranslations() |
||
221 | { |
||
222 | // $translationsPath = $this->getResourcesPath('lang'); |
||
223 | // $this->loadTranslationsFrom($translationsPath, 'audit'); |
||
224 | // $this->publishes([ |
||
225 | // $translationsPath => resource_path('lang'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'audit'), |
||
226 | // ], 'translations');// @todo ou lang, verificar (invez de translations) |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * Configs Paths |
||
231 | */ |
||
232 | private function getResourcesPath($folder) |
||
233 | { |
||
234 | return __DIR__.'/../resources/'.$folder; |
||
235 | } |
||
236 | |||
237 | private function getPublishesPath($folder) |
||
238 | { |
||
239 | return __DIR__.'/../publishes/'.$folder; |
||
240 | } |
||
241 | |||
242 | private function getDistPath($folder = '') |
||
0 ignored issues
–
show
|
|||
243 | { |
||
244 | return __DIR__.'/../dist/'.$folder; |
||
245 | } |
||
246 | } |
||
247 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: