Issues (286)

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.

Ship/core/Generator/Commands/ModelGenerator.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 Apiato\Core\Generator\Commands;
4
5
use Apiato\Core\Generator\GeneratorCommand;
6
use Apiato\Core\Generator\Interfaces\ComponentsGenerator;
7
use Illuminate\Support\Pluralizer;
8
use Illuminate\Support\Str;
9
use Symfony\Component\Console\Input\InputOption;
10
11
/**
12
 * Class ModelGenerator
13
 *
14
 * @author  Justin Atack  <[email protected]>
15
 */
16
class ModelGenerator extends GeneratorCommand implements ComponentsGenerator
17
{
18
19
    /**
20
     * The console command name.
21
     *
22
     * @var string
23
     */
24
    protected $name = 'apiato:generate:model';
25
26
    /**
27
     * The console command description.
28
     *
29
     * @var string
30
     */
31
    protected $description = 'Create a new Model class';
32
33
    /**
34
     * The type of class being generated.
35
     *
36
     * @var string
37
     */
38
    protected $fileType = 'Model';
39
40
    /**
41
     * The structure of the file path.
42
     *
43
     * @var  string
44
     */
45
    protected $pathStructure = '{container-name}/Models/*';
46
47
    /**
48
     * The structure of the file name.
49
     *
50
     * @var  string
51
     */
52
    protected $nameStructure = '{file-name}';
53
54
    /**
55
     * The name of the stub file.
56
     *
57
     * @var  string
58
     */
59
    protected $stubName = 'model.stub';
60
61
    /**
62
     * User required/optional inputs expected to be passed while calling the command.
63
     * This is a replacement of the `getArguments` function "which reads whenever it's called".
64
     *
65
     * @var  array
66
     */
67
    public $inputs = [
68
        ['repository', null, InputOption::VALUE_OPTIONAL, 'Generate the corresponding Repository for this Model?'],
69
    ];
70
71
    /**
72
     * @return array
73
     */
74
    public function getUserInputs()
75
    {
76
        $repository = $this->checkParameterOrConfirm('repository', 'Do you want to generate the corresponding Repository for this Model?', true);
77 View Code Duplication
        if($repository) {
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...
78
            // we need to generate a corresponding repository
79
            // so call the other command
80
            $status = $this->call('apiato:generate:repository', [
81
                '--container' => $this->containerName,
82
                '--file' => $this->fileName . 'Repository'
83
            ]);
84
85
            if ($status == 0) {
86
                $this->printInfoMessage('The Repository was successfully generated');
87
            }
88
            else {
89
                $this->printErrorMessage('Could not generate the corresponding Repository!');
90
            }
91
        }
92
93
        return [
94
            'path-parameters' => [
95
                'container-name' => $this->containerName,
96
            ],
97
            'stub-parameters' => [
98
                '_container-name' => Str::lower($this->containerName),
99
                'container-name' => $this->containerName,
100
                'class-name' => $this->fileName,
101
                'resource-key' => strtolower(Pluralizer::plural($this->fileName)),
102
            ],
103
            'file-parameters' => [
104
                'file-name' => $this->fileName,
105
            ],
106
        ];
107
    }
108
109
}
110