PHP Classes

PHP Security Checker: Scan project packages to check for vulnerabilities

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 71 All time: 10,270 This week: 146Up
Version License PHP version Categories
security-checker 1.0.0Custom (specified...5PHP 5, Web services, Project Management, S...
Description 

Author

This package can scan project packages to check for vulnerabilities.

It takes as parameter the path of a composer.lock file used in a project with packages installed with the Composer tool.

The package can check the installed packages against a vulnerabilities database using the Security Checker API and returns a list of known vulnerabilities that the installed packages have in their current versions.

Innovation Award
PHP Programming Innovation award nominee
March 2021
Number 5
Many projects use PHP composer tool to install its packages. This way it is easier to know all the external packages that are necessary to run a PHP project.

This package takes advantage of that possibility to determine if a project is using packages that have security vulnerabilities by checking the Security Checker API.

Manuel Lemos
Picture of Paras Malhotra
Name: Paras Malhotra <contact>
Classes: 1 package by
Country: United States United States
Innovation award
Innovation award
Nominee: 1x

 

Documentation

Enlightn Security Checker

tests MIT Licensed Latest Stable Version Total Downloads

The Enlightn Security Checker is a command line tool that checks if your application uses dependencies with known security vulnerabilities. It uses the Security Advisories Database.

Installation Options

  1. You may install the Enlightn Security Checker with Composer globally, for use with multiple projects:
composer global require enlightn/security-checker

  1. You may also install the Enlightn Security Checker in your project as a dev dependency using Composer:
composer require --dev enlightn/security-checker

  1. Instead of installing via Composer, you may also download the security-checker.phar file. Then, in the commands below you can replace `security-checker` with `security-checker.phar`.

Usage

To check for security vulnerabilities in your dependencies, you may run the security:check command:

php security-checker security:check /path/to/composer.lock

This command will return a success status code of 0 if there are no vulnerabilities and 1 if there is at least one vulnerability.

Note: You would need to provide the full path of the security-checker executable if the directory is not in your path. For instance:

php vendor/bin/security-checker security:check /path/to/composer.lock

Options

Format

By default, this command displays the result in ANSI. You may use the --format option to display the result in JSON instead:

php security-checker security:check /path/to/composer.lock --format=json

Exclude Dev Dependencies

If you would like to exclude dev dependencies from the vulnerabilities scanning, you may use the --no-dev option (defaults to false):

php security-checker security:check /path/to/composer.lock --no-dev

Custom Directory for Caching Advisories Database

By default, the SecurityChecker API and the security:check command use the directory returned by the sys_get_temp_dir PHP function for storing the cached advisories database. If you wish to modify the directory, you may use the --temp-dir option:

php security-checker security:check /path/to/composer.lock --temp-dir=/tmp

API

You may also use the API directly in your own code like so:

use Enlightn\SecurityChecker\SecurityChecker;

$result = (new SecurityChecker)->check('/path/to/composer.lock');

The result above is in JSON format. The key is the package name and the value is an array of vulnerabilities based on your package version. An example is as below:

{
  "laravel/framework": {
    "version": "8.22.0",
    "time": "2021-01-13T13:37:56+00:00",
    "advisories": [{
      "title": "Unexpected bindings in QueryBuilder",
      "link": "https://blog.laravel.com/security-laravel-62011-7302-8221-released",
      "cve": null
    }]
  }
}

Contribution Guide

Thank you for considering contributing to the Enlightn security-checker project! The contribution guide can be found here.

License

The Enlightn security checkers licensed under the MIT license.


  Files folder image Files (997)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (10 files)
Files folder imagetests (4 files, 1 directory)
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file box.json Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file security-checker Example Example script
Accessible without login Plain text file SECURITY.md Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:0
All time:10,270
This week:146Up