Issues (53)

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.

Generators/Commands/ControllerMakeCommand.php (1 issue)

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 LaravelPlus\Extension\Generators\Commands;
4
5
use Jumilla\Generators\Laravel\OneFileGeneratorCommand as BaseCommand;
6
use Jumilla\Generators\FileGenerator;
7
use LaravelPlus\Extension\Addons\Addon;
8
use LaravelPlus\Extension\Generators\GeneratorCommandTrait;
9
use InvalidArgumentException;
10
11
class ControllerMakeCommand extends BaseCommand
12
{
13
    use GeneratorCommandTrait;
14
15
    /**
16
     * The console command singature.
17
     *
18
     * @var string
19
     */
20
    protected $signature = 'make:controller
21
        {name : The name of the class}
22
        {--a|addon= : The name of the addon}
23
        {--m|model= : Generate a resource controller for the given model}
24
        {--r|resource : Generate a resource controller class}
25
    ';
26
27
    /**
28
     * The console command description.
29
     *
30
     * @var string
31
     */
32
    protected $description = '[+] Create a new controller class';
33
34
    /**
35
     * The type of class being generated.
36
     *
37
     * @var string
38
     */
39
    protected $type = 'Controller';
40
41
    /**
42
     * The constructor.
43
     */
44 9
    public function __construct()
45
    {
46 9
        parent::__construct();
47
48 9
        $this->setStubDirectory(__DIR__.'/../stubs');
49 9
    }
50
51
    /**
52
     * Get the default namespace for the class.
53
     *
54
     * @return string
55
     */
56 6
    protected function getDefaultNamespace()
57
    {
58 6
        return $this->getRootNamespace().'\\'.($this->onAddon() ? 'Controllers' : 'Http\\Controllers');
59
    }
60
61
    /**
62
     * Get the stub file for the generator.
63
     *
64
     * @return string
65
     */
66 6
    protected function getStub()
67
    {
68 6
        if ($this->option('model')) {
69 2
            return 'controller-model.stub';
70
        }
71 4
        return $this->option('resource') ? 'controller-resource.stub' : 'controller-plain.stub';
72
    }
73
74
    /**
75
     * Generate file.
76
     *
77
     * @param \Jumilla\Generators\FileGenerator $generator
78
     * @param string $path
79
     * @param string $fqcn
80
     *
81
     * @return bool
82
     */
83 6
    protected function generateFile(FileGenerator $generator, $path, $fqcn)
84
    {
85 6
        list($namespace, $class) = $this->splitFullQualifyClassName($fqcn);
86 6
        list($model_namespace, $model_class) = $this->splitFullQualifyClassName($this->parseModel($this->option('model', '')));
0 ignored issues
show
The call to ControllerMakeCommand::option() has too many arguments starting with ''.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
87
88 6
        return $generator->file($path)->template($this->getStub(), [
89 6
            'namespace' => $namespace,
90 6
            'root_namespace' => $this->getAppNamespace(),   // use App\Http\Controllers\Controller
91 6
            'class' => $class,
92 6
            'model_namespace' => $model_namespace ? $model_namespace.'\\' : '',
93 6
            'model_class' => $model_class,
94
        ]);
95
    }
96
97
    /**
98
     * Get the fully-qualified model class name.
99
     *
100
     * @param  string  $model
101
     * @return string
102
     */
103 6
    protected function parseModel($model)
104
    {
105 6
        if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
106
            throw new InvalidArgumentException('Model name contains invalid characters.');
107
        }
108
109 6
        $model = trim(str_replace('/', '\\', $model), '\\');
110
111 6
        return $model;
112
    }
113
}
114