Issues (80)

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/TelefonicaProvider.php (2 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
2
3
namespace Telefonica;
4
5
use App;
6
use Config;
7
use Illuminate\Contracts\Events\Dispatcher;
8
use Illuminate\Foundation\AliasLoader;
9
use Illuminate\Routing\Router;
10
11
use Illuminate\Support\Collection;
12
use Illuminate\Support\Facades\View;
13
use Illuminate\Support\ServiceProvider;
14
use Log;
15
use Muleta\Traits\Providers\ConsoleTools;
16
17
use Route;
18
19
use Telefonica\Facades\Telefonica as TelefonicaFacade;
20
use Telefonica\Services\TelefonicaService;
21
22
class TelefonicaProvider extends ServiceProvider
23
{
24
    use ConsoleTools;
25
26
    public $packageName = 'telefonica';
27
    const pathVendor = 'sierratecnologia/telefonica';
28
29
    public static $aliasProviders = [
30
        'Telefonica' => \Telefonica\Facades\Telefonica::class,
31
    ];
32
33
    public static $providers = [
34
35
        \Population\PopulationProvider::class,
36
37
        
38
    ];
39
40
    /**
41
     * Rotas do Menu
42
     */
43
    public static $menuItens = [
44
        // Igual em: Locaravel, Bancario, Telefonica, Informate, Population
45
        [
46
            'text' => 'Universo',
47
            'icon' => 'fas fa-fw fa-globe-americas',
48
            'icon_color' => "blue",
49
            'label_color' => "success",
50
            'order' => 2800,
51
            'section' => "admin",
52
            // 'feature' => 'bancario',
53
            'dev_status'  => 2, // 0 (Desabilitado), 1 (Ativo), 2 (Em Dev)
54
            'level'       => 2, // 0 (Public), 1, 2 (Admin) , 3 (Root)
55
        ],
56
        'Universo' => [
57
            [
58
                'text' => 'Pessoas',
59
                'icon' => 'fas fa-fw fa-search',
60
                'icon_color' => "blue",
61
                'label_color' => "success",
62
                // 'section' => "master", @todo
63
                'feature' => 'telefonica',
64
                'order' => 2820,
65
                'dev_status'  => 1, // 0 (Desabilitado), 1 (Ativo), 2 (Em Dev)
66
                'level'       => 1, // 0 (Public), 1, 2 (Admin) , 3 (Root)
67
            ],
68
            'Pessoas' => [
69
                [
70
                    'text'        => 'Pessoas',
71
                    'route'       => 'painel.telefonica.persons.index',
72
                    'icon'        => 'fas fa-fw fa-ship',
73
                    'icon_color'  => 'blue',
74
                    'label_color' => 'success',
75
                    'section' => "painel",
76
                    'feature' => 'telefonica',
77
                    'dev_status'  => 1, // 0 (Desabilitado), 1 (Ativo), 2 (Em Dev)
78
                    'level'       => 1, // 0 (Public), 1, 2 (Admin) , 3 (Root)
79
                    // 'access' => \Porteiro\Models\Role::$ADMIN
80
                ],
81
                [
82
                    'text'        => 'Telefones',
83
                    'route'       => 'admin.telefonica.phones.index',
84
                    'icon'        => 'fas fa-fw fa-address-book',
85
                    'icon_color'  => 'blue',
86
                    'label_color' => 'success',
87
                    'section' => "admin",
88
                    'feature' => 'telefonica',
89
                    'dev_status'  => 1, // 0 (Desabilitado), 1 (Ativo), 2 (Em Dev)
90
                    'level'       => 1, // 0 (Public), 1, 2 (Admin) , 3 (Root)
91
                    // 'access' => \Porteiro\Models\Role::$ADMIN
92
                ],
93
            ],
94
        ],
95
    ];
96
97
    /**
98
     * Alias the services in the boot.
99
     */
100
    public function boot()
101
    {
102
        
103
        // Register configs, migrations, etc
104
        $this->registerDirectories();
105
106
        // COloquei no register pq nao tava reconhecendo as rotas para o adminlte
107
        $this->app->booted(
108
            function () {
109
                $this->routes();
110
            }
111
        );
112
113
        $this->loadLogger();
114
    }
115
116
    /**
117
     * Register the tool's routes.
118
     *
119
     * @return void
120
     */
121
    protected function routes()
122
    {
123
        if ($this->app->routesAreCached()) {
0 ignored issues
show
The method routesAreCached() 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
            return;
125
        }
126
        /**
127
         * Transmissor; Routes
128
         */
129
        $this->loadRoutesForRiCa(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'routes');
130
    }
131
132
    /**
133
     * Register the services.
134
     */
135
    public function register()
136
    {
137
        $this->mergeConfigFrom($this->getPublishesPath('config'.DIRECTORY_SEPARATOR.'sitec'.DIRECTORY_SEPARATOR.'telefonica.php'), 'sitec.telefonica');
138
        
139
140
        $this->setProviders();
141
        // $this->routes();
142
143
144
145
        // Register Migrations
146
        $this->loadMigrationsFrom(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'migrations');
147
148
        $this->app->singleton(
149
            'telefonica', function () {
150
                return new Telefonica();
151
            }
152
        );
153
        
154
        /*
155
        |--------------------------------------------------------------------------
156
        | Register the Utilities
157
        |--------------------------------------------------------------------------
158
        */
159
        /**
160
         * Singleton Telefonica;
161
         */
162
        $this->app->singleton(
163
            TelefonicaService::class, function ($app) {
0 ignored issues
show
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
164
                Log::channel('sitec-telefonica')->info('Singleton Telefonica;');
165
                return new TelefonicaService(\Illuminate\Support\Facades\Config::get('sitec.telefonica'));
166
            }
167
        );
168
169
        // Register commands
170
        $this->registerCommandFolders(
171
            [
172
            base_path('vendor/sierratecnologia/telefonica/src/Console/Commands') => '\Telefonica\Console\Commands',
173
            ]
174
        );
175
176
        // /**
177
        //  * Helpers
178
        //  */
179
        // Aqui noa funciona
180
        // if (!function_exists('telefonica_asset')) {
181
        //     function telefonica_asset($path, $secure = null)
182
        //     {
183
        //         return route('rica.telefonica.assets').'?path='.urlencode($path);
184
        //     }
185
        // }
186
    }
187
188
    /**
189
     * Get the services provided by the provider.
190
     *
191
     * @return array
192
     */
193
    public function provides()
194
    {
195
        return [
196
            'telefonica',
197
        ];
198
    }
199
200
    /**
201
     * Register configs, migrations, etc
202
     *
203
     * @return void
204
     */
205
    public function registerDirectories()
206
    {
207
        // Publish config files
208
        $this->publishes(
209
            [
210
            // Paths
211
            $this->getPublishesPath('config'.DIRECTORY_SEPARATOR.'sitec') => config_path('sitec'),
212
            ], ['config',  'sitec', 'sitec-config']
213
        );
214
215
        // // Publish telefonica css and js to public directory
216
        // $this->publishes([
217
        //     $this->getDistPath('telefonica') => public_path('assets/telefonica')
218
        // ], ['public',  'sitec', 'sitec-public']);
219
220
        $this->loadViews();
221
        $this->loadTranslations();
222
    }
223
224
    private function loadViews()
225
    {
226
        // View namespace
227
        $viewsPath = $this->getResourcesPath('views');
228
        $this->loadViewsFrom($viewsPath, 'telefonica');
229
        $this->publishes(
230
            [
231
            $viewsPath => base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'telefonica'),
232
            ], ['views',  'sitec', 'sitec-views']
233
        );
234
    }
235
    
236
    private function loadTranslations()
237
    {
238
        // Publish lanaguage files
239
        $this->publishes(
240
            [
241
            $this->getResourcesPath('lang') => resource_path('lang'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'telefonica')
242
            ], ['lang',  'sitec', 'sitec-lang', 'translations']
243
        );
244
245
        // Load translations
246
        $this->loadTranslationsFrom($this->getResourcesPath('lang'), 'telefonica');
247
    }
248
249
250
    /**
251
     *
252
     */
253
    private function loadLogger()
254
    {
255
        Config::set(
256
            'logging.channels.sitec-telefonica', [
257
            'driver' => 'single',
258
            'path' => storage_path('logs'.DIRECTORY_SEPARATOR.'sitec-telefonica.log'),
259
            'level' => env('APP_LOG_LEVEL', 'debug'),
260
            ]
261
        );
262
    }
263
}
264