Issues (85)

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/ArtificerServiceProvider.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 namespace Mascame\Artificer;
2
3
4
use Illuminate\Support\ServiceProvider;
5
use App;
6
use Config;
7
use Illuminate\Support\Str;
8
use Mascame\Artificer\Extension\Booter;
9
use Mascame\Artificer\Extension\PluginManager;
10
use Mascame\Artificer\Extension\WidgetManager;
11
use Mascame\Artificer\Model\Model;
12
use Mascame\Artificer\Model\ModelObtainer;
13
use Mascame\Artificer\Model\ModelSchema;
14
use Mascame\Extender\Event\Event;
15
use Mascame\Extender\Installer\FileInstaller;
16
use Mascame\Extender\Installer\FileWriter;
17
18
19
class ArtificerServiceProvider extends ServiceProvider {
20
21
	protected $name = 'admin';
22
	/**
23
	 * Indicates if loading of the provider is deferred.
24
	 *
25
	 * @var bool
26
	 */
27
	protected $defer = false;
28
29
	/**
30
	 * Bootstrap the application events.
31
	 *
32
	 * @return void
33
	 */
34
	public function boot()
35
	{
36
        if (! Artificer::isBooted()) return;
37
38
		$this->addPublishing();
39
        $this->requireFiles();
40
	}
41
42
    /**
43
     * Determines if is on admin
44
     *
45
     * @return bool
46
     */
47
    public function isBootable($path, $routePrefix = null) {
48
        if (App::runningInConsole() || App::runningUnitTests()) return true;
49
50
        return (
51
            $path == $routePrefix || Str::startsWith($path, $routePrefix . '/')
52
        );
53
    }
54
55
	private function requireFiles()
56
	{
57
		require_once __DIR__ . '/Http/filters.php';
58
		require_once __DIR__ . '/Http/routes.php';
59
	}
60
61
    private function addPublishing()
62
    {
63
        $this->publishes([
64
            __DIR__.'/../config/' => config_path($this->name) .'/',
65
        ]);
66
67
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', $this->name);
68
69
        $this->publishes([
70
            __DIR__.'/../database/migrations/' => database_path('migrations')
71
        ], 'migrations');
72
73
        $this->publishes([
74
            __DIR__.'/../database/seeds/' => database_path('seeds')
75
        ], 'seeds');
76
77
        $this->publishes([
78
            __DIR__.'/../resources/assets/' => public_path('packages/mascame/' . $this->name),
79
        ], 'public');
80
    }
81
82
	private function addModel()
83
	{
84
		App::singleton('artificer-model', function () {
85
			return new Model(new ModelSchema(new ModelObtainer()));
86
		});
87
	}
88
89
	private function addLocalization()
90
	{
91
		App::singleton('artificer-localization', function () {
92
			return new Localization();
93
		});
94
	}
95
96
	private function addManagers()
97
	{
98 View Code Duplication
		App::singleton('ArtificerPluginManager', function () {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
99
			$pluginsPath = config_path() . '/'. $this->name .'/plugins.php';
100
101
			return new PluginManager(
102
				new FileInstaller(new FileWriter(), $pluginsPath),
103
				new Booter(),
104
				new Event(app('events'))
105
			);
106
		});
107
108 View Code Duplication
		App::singleton('ArtificerWidgetManager', function () {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
			$widgetsPath = config_path() . '/'. $this->name .'/widgets.php';
110
111
			return new WidgetManager(
112
				new FileInstaller(new FileWriter(), $widgetsPath),
113
				new Booter(),
114
				new Event(app('events'))
115
			);
116
		});
117
	}
118
119
	/**
120
	 * Register the service provider.
121
	 *
122
	 * @return void
123
	 */
124
	public function register()
125
	{
126
        $configPath = __DIR__ . '/../config/admin.php';
127
        $this->mergeConfigFrom($configPath, $this->name);
128
129
        // Avoid bloating the App with files that will not be needed
130
        if (! $this->isBootable(request()->path(), config('admin.route_prefix'))) return;
131
132
        $this->addModel();
133
        $this->addLocalization();
134
        $this->addManagers();
135
136
//		$am = new AssetManager();
137
//		$am->set('jquery', new HttpAsset('https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'));
138
//		$am->set('artificer', new AssetCollection(array(
139
//			new AssetReference($am, 'jquery'),
140
//			new FileAsset(__DIR__.'/../resources/assets/core/restfulizer.js'),
141
//		)));
142
//
143
//        $ac = new AssetCollection($am);
144
//        var_dump($ac->dump()); die();
145
146
        Artificer::$booted = true;
147
	}
148
149
	/**
150
	 * Get the services provided by the provider.
151
	 *
152
	 * @return array
153
	 */
154
	public function provides()
155
	{
156
		return array();
157
	}
158
159
}
160