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/ModuleMigrateResetCommand.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
2
3
namespace Caffeinated\Modules\Console\Commands;
4
5
use Caffeinated\Modules\Modules;
6
use Illuminate\Console\ConfirmableTrait;
7
use Illuminate\Filesystem\Filesystem;
8
use Illuminate\Database\Migrations\Migrator;
9
use Illuminate\Console\Command;
10
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Input\InputArgument;
12
13
class ModuleMigrateResetCommand extends Command
14
{
15
    use ConfirmableTrait;
16
17
    /**
18
     * The console command name.
19
     *
20
     * @var string
21
     */
22
    protected $name = 'module:migrate:reset';
23
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Rollback all database migrations for a specific or all modules';
30
31
    /**
32
     * @var Modules
33
     */
34
    protected $module;
35
36
    /**
37
     * @var Migrator
38
     */
39
    protected $migrator;
40
41
    /**
42
     * @var Filesystem
43
     */
44
    protected $files;
45
46
    /**
47
     * Create a new command instance.
48
     *
49
     * @param Modules    $module
50
     * @param Filesystem $files
51
     * @param Migrator   $migrator
52
     */
53
    public function __construct(Modules $module, Filesystem $files, Migrator $migrator)
54
    {
55
        parent::__construct();
56
57
        $this->module   = $module;
58
        $this->files    = $files;
59
        $this->migrator = $migrator;
60
    }
61
62
    /**
63
     * Execute the console command.
64
     *
65
     * @return mixed
66
     */
67 View Code Duplication
    public function fire()
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...
68
    {
69
        if (!$this->confirmToProceed()) {
70
            return;
71
        }
72
73
        $slug = $this->argument('slug');
74
75
        if (!empty($slug)) {
76
            if ($this->module->isEnabled($slug)) {
77
                return $this->reset($slug);
78
            } elseif ($this->option('force')) {
79
                return $this->reset($slug);
80
            }
81
        } else {
82
            if ($this->option('force')) {
83
                $modules = $this->module->all()->reverse();
84
            } else {
85
                $modules = $this->module->enabled()->reverse();
86
            }
87
88
            foreach ($modules as $module) {
89
                $this->reset($module['slug']);
90
            }
91
        }
92
    }
93
94
    /**
95
     * Run the migration reset for the specified module.
96
     *
97
     * Migrations should be reset in the reverse order that they were
98
     * migrated up as. This ensures the database is properly reversed
99
     * without conflict.
100
     *
101
     * @param string $slug
102
     *
103
     * @return mixed
104
     */
105
    protected function reset($slug)
106
    {
107
        $this->migrator->setconnection($this->input->getOption('database'));
108
109
        $pretend       = $this->input->getOption('pretend');
110
        $migrationPath = $this->getMigrationPath($slug);
111
        $migrations    = array_reverse($this->migrator->getMigrationFiles($migrationPath));
112
113
        if (count($migrations) == 0) {
114
            return $this->error('Nothing to rollback.');
115
        }
116
117
        foreach ($migrations as $migration) {
118
            $this->info('Migration: '.$migration);
119
            $this->runDown($slug, $migration, $pretend);
120
        }
121
    }
122
123
    /**
124
     * Run "down" a migration instance.
125
     *
126
     * @param string $slug
127
     * @param object $migration
128
     * @param bool   $pretend
129
     */
130
    protected function runDown($slug, $migration, $pretend)
131
    {
132
        $migrationPath = $this->getMigrationPath($slug);
133
        $file          = (string) $migrationPath.'/'.$migration.'.php';
134
        $classFile     = implode('_', array_slice(explode('_', basename($file, '.php')), 4));
135
        $class         = studly_case($classFile);
136
        $table         = $this->laravel['config']['database.migrations'];
137
138
        include $file;
139
140
        $instance = new $class();
141
        $instance->down();
142
143
        $this->laravel['db']->table($table)
144
            ->where('migration', $migration)
145
            ->delete();
146
    }
147
148
    /**
149
     * Get the console command parameters.
150
     *
151
     * @param string $slug
152
     *
153
     * @return array
154
     */
155
    protected function getParameters($slug)
156
    {
157
        $params = [];
158
159
        $params['--path'] = $this->getMigrationPath($slug);
160
161
        if ($option = $this->option('database')) {
162
            $params['--database'] = $option;
163
        }
164
165
        if ($option = $this->option('pretend')) {
166
            $params['--pretend'] = $option;
167
        }
168
169
        if ($option = $this->option('seed')) {
170
            $params['--seed'] = $option;
171
        }
172
173
        return $params;
174
    }
175
176
    /**
177
     * Get migrations path.
178
     *
179
     * @return string
180
     */
181
    protected function getMigrationPath($slug)
182
    {
183
        $path = $this->module->getModulePath($slug).'Database/Migrations';
184
185
        return $path;
186
    }
187
188
    /**
189
     * Get the console command arguments.
190
     *
191
     * @return array
192
     */
193
    protected function getArguments()
194
    {
195
        return [['slug', InputArgument::OPTIONAL, 'Module slug.']];
196
    }
197
198
    /**
199
     * Get the console command options.
200
     *
201
     * @return array
202
     */
203 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...
204
    {
205
        return [
206
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
207
            ['force', null, InputOption::VALUE_NONE, 'Force the operation to run while in production.'],
208
            ['pretend', null, InputOption::VALUE_OPTIONAL, 'Dump the SQL queries that would be run.'],
209
            ['seed', null, InputOption::VALUE_OPTIONAL, 'Indicates if the seed task should be re-run.'],
210
        ];
211
    }
212
}
213