bernardosecades/packagist-security-checker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bernardosecades/packagist-security-checker

Composer 安装命令:

composer require bernardosecades/packagist-security-checker

包简介

Check possible bugs in your dependencies

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage License SensioLabsInsight

About

Tool to check possible bugs in your dependencies (public and private dependencies). It is based on semver to detect bugs in your dependencies.

Example:

In your composer.lock you have this package:

"name": "twig/twig",
"version": "v1.24.1",

Where version follow format: MAJOR.MINOR.PATCH, read more in semver, so if exist in packagist that package with the same MAJOR, MINOR and next patch version mean you have a possible bug in your dependencies and you should update them.

Why?

Composer

With composer you can know if your dependencies need to be updated, example:

composer outdate

This command will show packages you can update and latest versions, but some times is not necessary update them if you do not need new funcionalities of those packages, but if your dependency there are bug fixes you should update them at least to last PATCH version, and you can get this info from Packagist Security Checker.

SensioLabs - Security Checker

This is a great tool created by SensioLabs. It checks if your application uses dependencies with known security vulnerabilities. It uses the SensioLabs Security Check Web service and the Security Advisories Database.

Usually bugs of most popular libraries are reported to Security Advisories Database, but libraries not really popular but they are used by others projects are not reported or maybe their database are not updated. As well this service works only for public repositories.

Packagist Security Checker

Packagist Security Checker use API from packagist and uses semantic versioning to detect possible bugs. It works with popular and no popular libraries if they are enabled in packagist.

This tool can be used as well in your instance of packagist in your company, so in this case can detect possible bugs in private repositories as well.

Limitations

  • If a package do not follow semantic versioning (example: tags v0.9 instead of v0.9.0) this package will be ignored like possible bugs, the tool can not check it.
  • It can happen semantic versioning is not used properly and can show you bad results, anyway you always will can check changelog file of that repository and confirm yourself.

Usage

See all report

./bin/packagist-security-checker sc <path-composer-lock-file>

See only bugs

./bin/packagist-security-checker sc <path-composer-lock-file> --only-bugs

Get report in json format

./bin/packagist-security-checker sc <path-composer-lock-file> --only-bugs --format=json

Execute tool with your own instance of packagist:

./bin/packagist-security-checker sc <path-composer-lock-file> --packagist-url=https://packagist.mycompany.com

Integration

You can easily integrate the checker into your project:

Add command in your Symfony Console Application

Using the PackagistSecurityCheckerCommand class into your Symfony Console application

use BernardoSecades\Packagist\SecurityChecker\PackagistSecurityChecker;
use BernardoSecades\Packagist\SecurityChecker\Command\PackagistSecurityCheckerCommand;

$app = new Application();
$app->add(new PackagistSecurityCheckerCommand(new PackagistSecurityChecker()));

Use class directly in your own code

Or using the PackagistSecurityChecker class directly in your own code

use BernardoSecades\Packagist\SecurityChecker\PackagistSecurityChecker;

$ch = new PackagistSecurityChecker();
$reportPackages = $ch->check('/path/composer.lock');

Installation

composer require bernardosecades/packagist-security-checker --dev

.phar file

You can also use already last built .phar.

$ git clone git@github.com:bernardosecades/packagist-security-checker.git
$ cd packagist-security-checker
$ php build/packagist-security-checker.phar

You can copy the .phar file as a global script

$ cp build/packagist-security-checker.phar /usr/local/bin/packagist-security-checker

Compile

You can also compile your own version of the package. (Remember you will need set phar.readonly = Off in your php.ini).

$ git clone git@github.com:bernardosecades/packagist-security-checker.git
$ cd packagist-security-checker.git
$ composer install
$ php bin/compile
$ sudo chmod +x build/packagist-security-checker.phar
$ build/packagist-security-checker.phar

You can copy the .phar file as a global script

$ cp build/packagist-security-checker.phar /usr/local/bin/packagist-security-checker

Screenshots

./bin/packagist-security-checker sc tests/fixtures/composer.lock

full report

./bin/packagist-security-checker sc tests/fixtures/composer.lock --only-bugs

only bugs

./bin/packagist-security-checker sc tests/fixtures/composer.lock --only-bugs --format=json

json format

统计信息

  • 总下载量: 6.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固