-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check command and fix dumpAutoloads for L5.1 (#32)
- Loading branch information
Showing
4 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace JeroenG\Packager; | ||
|
||
use SensioLabs\Security\SecurityChecker; | ||
use SensioLabs\Security\Formatters\SimpleFormatter; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
/** | ||
* List all locally installed packages. | ||
* | ||
* @package Packager | ||
* @author JeroenG | ||
* | ||
**/ | ||
class PackagerCheckCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'packager:check {vendor} {name}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Check the composer.lock for security vulnerabilities.'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->info('Using the SensioLabs Security Checker the composer.lock of the package is scanned for known security vulnerabilities in the dependencies.'); | ||
$this->info('Make sure you have a composer.lock file first (for example by running "composer install" in the folder'); | ||
|
||
$checker = new SecurityChecker(); | ||
$formatter = new SimpleFormatter($this->getHelperSet()->get('formatter')); | ||
$vendor = $this->argument('vendor'); | ||
$name = $this->argument('name'); | ||
$lockfile = getcwd().'/packages/'.$vendor.'/'.$name.'/composer.lock'; | ||
$vulnerabilities = $checker->check($lockfile); | ||
|
||
return $formatter->displayResults($this->output, $lockfile, $vulnerabilities); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters