Issues (33)

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/WorkflowServiceProvider.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 Cerbero\Workflow;
2
3
use Cerbero\Workflow\WorkflowRunner;
4
use Illuminate\Foundation\AliasLoader;
5
use Illuminate\Support\ServiceProvider;
6
use Cerbero\Workflow\Inflectors\Inflector;
7
use Cerbero\Workflow\Wrappers\SymfonyYamlParser;
8
use Cerbero\Workflow\Repositories\YamlPipelineRepository;
9
use Cerbero\Workflow\Wrappers\LaravelTraitNamespaceDetector;
10
11
/**
12
 * Workflow service provider.
13
 *
14
 * @author	Andrea Marco Sartori
15
 */
16
class WorkflowServiceProvider extends ServiceProvider {
17
18
	/**
19
	 * @author	Andrea Marco Sartori
20
	 * @var		array	$commands	List of registered commands.
21
	 */
22
	protected $commands = [
23
		'cerbero.workflow.create',
24
		'cerbero.workflow.read',
25
		'cerbero.workflow.update',
26
		'cerbero.workflow.delete',
27
	];
28
29
	/**
30
	 * Boot the package up.
31
	 *
32
	 * @author	Andrea Marco Sartori
33
	 * @return	void
34
	 */
35
	public function boot()
36
	{
37
		$this->publishConfig();
38
39
		$this->commands($this->commands);
40
41
		$facade = 'Cerbero\Workflow\Facades\Workflow';
42
43
		AliasLoader::getInstance()->alias('Workflow', $facade);
44
	}
45
46
	/**
47
	 * Publish the configuration file.
48
	 *
49
	 * @author	Andrea Marco Sartori
50
	 * @return	void
51
	 */
52
	private function publishConfig()
53
	{
54
		$config = __DIR__ . '/config/workflow.php';
55
56
		$this->publishes([$config => config_path('workflow.php')]);
57
58
		$this->mergeConfigFrom($config, 'workflow');
59
	}
60
61
	/**
62
	 * Register the services.
63
	 *
64
	 * @author	Andrea Marco Sartori
65
	 * @return	void
66
	 */
67
	public function register()
68
	{
69
		$this->registerPipelineRepository();
70
71
		$this->registerInflector();
72
73
		$this->registerDispatcher();
74
75
		$this->registerWorkflow();
76
77
		$this->registerWorkflowRunnersHook();
78
79
		$this->registerCommands();
80
	}
81
82
	/**
83
	 * Register the pipeline repository.
84
	 *
85
	 * @author	Andrea Marco Sartori
86
	 * @return	void
87
	 */
88
	private function registerPipelineRepository()
89
	{
90
		$abstract = 'Cerbero\Workflow\Repositories\PipelineRepositoryInterface';
91
92
		$this->app->bind($abstract, 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...
93
		{
94
			return new YamlPipelineRepository
95
			(
96
				new SymfonyYamlParser,
97
98
				new \Illuminate\Filesystem\Filesystem,
99
100
				config('workflow.path')
101
			);
102
		});
103
	}
104
105
	/**
106
	 * Register the inflector.
107
	 *
108
	 * @author	Andrea Marco Sartori
109
	 * @return	void
110
	 */
111
	private function registerInflector()
112
	{
113
		$abstract = 'Cerbero\Workflow\Inflectors\InflectorInterface';
114
115
		$this->app->bind($abstract, function()
116
		{
117
			return new Inflector(new LaravelTraitNamespaceDetector);
118
		});
119
	}
120
121
	/**
122
	 * Register the bus dispatcher.
123
	 *
124
	 * @author	Andrea Marco Sartori
125
	 * @return	void
126
	 */
127
	private function registerDispatcher()
128
	{
129
		$abstract = 'Cerbero\Workflow\Wrappers\DispatcherInterface';
130
131
		$this->app->bind($abstract, function($app)
132
		{
133
			return $app['Cerbero\Workflow\Wrappers\MarshalDispatcher'];
134
		});
135
	}
136
137
	/**
138
	 * Register the package main class.
139
	 *
140
	 * @author	Andrea Marco Sartori
141
	 * @return	void
142
	 */
143
	private function registerWorkflow()
144
	{
145
		$this->app->singleton('cerbero.workflow', function($app)
146
		{
147
			return $app['Cerbero\Workflow\Workflow'];
148
		});
149
	}
150
151
	/**
152
	 * Register the hook for the workflow runners.
153
	 *
154
	 * @author	Andrea Marco Sartori
155
	 * @return	void
156
	 */
157
	private function registerWorkflowRunnersHook()
158
	{
159
		$this->app->afterResolving(function(WorkflowRunner $runner, $app)
0 ignored issues
show
function (\Cerbero\Workf...'cerbero.workflow']); } is of type object<Closure>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
160
		{
161
			$runner->setWorkflow($app['cerbero.workflow']);
162
		});
163
	}
164
165
	/**
166
	 * Register the console commands.
167
	 *
168
	 * @author	Andrea Marco Sartori
169
	 * @return	void
170
	 */
171
	private function registerCommands()
172
	{
173
		foreach ($this->commands as $command)
174
		{
175
			$name = ucfirst(last(explode('.', $command)));
176
177
			$this->app->singleton($command, function($app) use($name)
178
			{
179
				return $app["Cerbero\Workflow\Console\Commands\\{$name}WorkflowCommand"];
180
			});
181
		}
182
	}
183
184
}
185