GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (46)

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/ModuleMigrateCommand.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 Caffeinated\Modules\Console\Commands;
4
5
use App;
6
use Caffeinated\Modules\Modules;
7
use Illuminate\Console\Command;
8
use Illuminate\Console\ConfirmableTrait;
9
use Illuminate\Database\Migrations\Migrator;
10
use Illuminate\Support\Arr;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Input\InputArgument;
13
14
class ModuleMigrateCommand extends Command
15
{
16
    use ConfirmableTrait;
17
18
    /**
19
     * The console command name.
20
     *
21
     * @var string
22
     */
23
    protected $name = 'module:migrate';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Run the database migrations for a specific or all modules';
31
32
    /**
33
     * @var Modules
34
     */
35
    protected $module;
36
37
    /**
38
     * @var Migrator
39
     */
40
    protected $migrator;
41
42
    /**
43
     * Create a new command instance.
44
     *
45
     * @param Migrator $migrator
46
     * @param Modules  $module
47
     */
48
    public function __construct(Migrator $migrator, Modules $module)
49
    {
50
        parent::__construct();
51
52
        $this->migrator = $migrator;
53
        $this->module   = $module;
54
    }
55
56
    /**
57
     * Execute the console command.
58
     *
59
     * @return mixed
60
     */
61
    public function fire()
62
    {
63
        $this->prepareDatabase();
64
65
        if (!empty($this->argument('slug'))) {
66
            $module = $this->module->where('slug', $this->argument('slug'))->first();
67
68
            if ($this->module->isEnabled($module['slug'])) {
69
                return $this->migrate($module['slug']);
70
            } elseif ($this->option('force')) {
71
                return $this->migrate($module['slug']);
72
            } else {
73
                return $this->error('Nothing to migrate.');
74
            }
75
        } else {
76
            if ($this->option('force')) {
77
                $modules = $this->module->all();
78
            } else {
79
                $modules = $this->module->enabled();
80
            }
81
82
            foreach ($modules as $module) {
83
                $this->migrate($module['slug']);
84
            }
85
        }
86
    }
87
88
    /**
89
     * Run migrations for the specified module.
90
     *
91
     * @param string $slug
92
     *
93
     * @return mixed
94
     */
95
    protected function migrate($slug)
96
    {
97
        if ($this->module->exists($slug)) {
98
            $pretend = Arr::get($this->option(), 'pretend', false);
99
            $path    = $this->getMigrationPath($slug);
100
101
            if (floatval(App::version()) > 5.1) {
102
                $pretend = ['pretend' => $pretend];
103
            }
104
105
            $this->migrator->run($path, $pretend);
106
107
            // Once the migrator has run we will grab the note output and send it out to
108
            // the console screen, since the migrator itself functions without having
109
            // any instances of the OutputInterface contract passed into the class.
110
            foreach ($this->migrator->getNotes() as $note) {
111
                if (!$this->option('quiet')) {
112
                    $this->line($note);
113
                }
114
            }
115
116
            // Finally, if the "seed" option has been given, we will re-run the database
117
            // seed task to re-populate the database, which is convenient when adding
118
            // a migration and a seed at the same time, as it is only this command.
119
            if ($this->option('seed')) {
120
                $this->call('module:seed', ['module' => $slug, '--force' => true]);
121
            }
122
        } else {
123
            return $this->error('Module does not exist.');
124
        }
125
    }
126
127
    /**
128
     * Get migration directory path.
129
     *
130
     * @param string $slug
131
     *
132
     * @return string
133
     */
134
    protected function getMigrationPath($slug)
135
    {
136
        $path = $this->module->getModulePath($slug);
137
138
        return $path.'Database/Migrations/';
139
    }
140
141
    /**
142
     * Prepare the migration database for running.
143
     */
144
    protected function prepareDatabase()
145
    {
146
        $this->migrator->setConnection($this->option('database'));
147
148
        if (!$this->migrator->repositoryExists()) {
149
            $options = array('--database' => $this->option('database'));
150
151
            $this->call('migrate:install', $options);
152
        }
153
    }
154
155
    /**
156
     * Get the console command arguments.
157
     *
158
     * @return array
159
     */
160
    protected function getArguments()
161
    {
162
        return [['slug', InputArgument::OPTIONAL, 'Module slug.']];
163
    }
164
165
    /**
166
     * Get the console command options.
167
     *
168
     * @return array
169
     */
170 View Code Duplication
    protected function getOptions()
0 ignored issues
show
This method seems to be duplicated in 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...
171
    {
172
        return [
173
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
174
            ['force', null, InputOption::VALUE_NONE, 'Force the operation to run while in production.'],
175
            ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'],
176
            ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'],
177
        ];
178
    }
179
}
180