Issues (28)

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/Console/Commands/MigrateMakeCommand.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 JunaidQadirB\Cray\Console\Commands;
4
5
6
use Illuminate\Database\Console\Migrations\BaseCommand;
7
use Illuminate\Database\Migrations\MigrationCreator;
8
use Illuminate\Support\Composer;
9
use Illuminate\Support\Str;
10
11
class MigrateMakeCommand extends BaseCommand
12
{
13
    /**
14
     * The console command signature.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'cray:migration {name : The name of the migration.}
19
        {--create= : The table to be created.}
20
        {--table= : The table to migrate.}
21
        {--path= : The location where the migration file should be created.}
22
        {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths.}
23
        {--fullpath : Output the full path of the migration}';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Create a new migration file';
31
32
    /**
33
     * The migration creator instance.
34
     *
35
     * @var \Illuminate\Database\Migrations\MigrationCreator
36
     */
37
    protected $creator;
38
39
    /**
40
     * The Composer instance.
41
     *
42
     * @var \Illuminate\Support\Composer
43
     */
44
    protected $composer;
45
46
    /**
47
     * Create a new migration install command instance.
48
     *
49
     * @param  \Illuminate\Database\Migrations\MigrationCreator  $creator
50
     * @param  \Illuminate\Support\Composer  $composer
51
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
52
     */
53
    public function __construct(MigrationCreator $creator, Composer $composer)
54
    {
55
        parent::__construct();
56
57
        $this->creator = $creator;
58
        $this->composer = $composer;
59
    }
60
61
    /**
62
     * Execute the console command.
63
     *
64
     * @return void
65
     */
66
    public function handle()
67
    {
68
        // It's possible for the developer to specify the tables to modify in this
69
        // schema operation. The developer may also specify if this table needs
70
        // to be freshly created so we can create the appropriate migrations.
71
        $name = Str::snake(trim($this->input->getArgument('name')));
72
73
        $table = $this->input->getOption('table');
74
75
        $create = $this->input->getOption('create') ?: false;
76
77
        // If no table was given as an option but a create option is given then we
78
        // will use the "create" option as the table name. This allows the devs
79
        // to pass a table name into this option as a short-cut for creating.
80
        if (! $table && is_string($create)) {
81
            $table = $create;
82
83
            $create = true;
84
        }
85
86
        // Next, we will attempt to guess the table name if this the migration has
87
        // "create" in the name. This will allow us to provide a convenient way
88
        // of creating migrations that create new tables for the application.
89
        if (! $table) {
90
            [$table, $create] = TableGuesser::guess($name);
91
        }
92
93
        // Now we are ready to write the migration out to disk. Once we've written
94
        // the migration out, we will dump-autoload for the entire framework to
95
        // make sure that the migrations are registered by the class loaders.
96
        $this->writeMigration($name, $table, $create);
97
98
        $this->composer->dumpAutoloads();
99
    }
100
101
    /**
102
     * Write the migration file to disk.
103
     *
104
     * @param  string  $name
105
     * @param  string  $table
106
     * @param  bool  $create
107
     * @return string
108
     */
109
    protected function writeMigration($name, $table, $create)
110
    {
111
        $file = $this->creator->create(
112
            $name, $this->getMigrationPath(), $table, $create
113
        );
114
115
        if (! $this->option('fullpath')) {
116
            $file = pathinfo($file, PATHINFO_FILENAME);
117
        }
118
119
        $this->line("<info>Created Migration:</info> {$file}");
120
    }
121
122
    /**
123
     * Get migration path (either specified by '--path' option or default location).
124
     *
125
     * @return string
126
     */
127
    protected function getMigrationPath()
128
    {
129
        if (! is_null($targetPath = $this->input->getOption('path'))) {
130
            return ! $this->usingRealPath()
131
                            ? $this->laravel->basePath().'/'.$targetPath
132
                            : $targetPath;
133
        }
134
135
        return parent::getMigrationPath();
136
    }
137
138
    /**
139
     * Determine if the given path(s) are pre-resolved "real" paths.
140
     *
141
     * @return bool
142
     */
143
    protected function usingRealPath()
144
    {
145
        return $this->input->hasOption('realpath') && $this->option('realpath');
146
    }
147
}
148