Laravel Packages

CLI to Check For PHP Security Vulnerabilities

Published
CLI to Check For PHP Security Vulnerabilities image

Enlightn Security Checker (from the folks behind Enlightn) is a command-line tool that checks if your application uses dependencies with known security vulnerabilities.

You can install it globally via composer to start checking projects:

composer global require enlightn/security-checker

Using the security-checker CLI, you provide a path to your project’s composer.lock file to get a report of any vulnerabilities:

⇒ security-checker security:check /path/to/composer.lock
{
    "laravel\/framework": {
        "version": "5.7.29",
        "time": "2020-04-14T14:16:19+00:00",
        "advisories": [
            {
                "title": "RCE vulnerability in \"cookie\" session driver",
                "link": "https:\/\/blog.laravel.com\/laravel-cookie-security-releases",
                "cve": null
            }
        ]
    },
    "robrichards\/xmlseclibs": {
        "version": "2.1.1",
        "time": "2019-11-05T11:51:00+00:00",
        "advisories": [
            {
                "title": "Filter input to avoid XPath injection",
                "link": "https:\/\/github.com\/robrichards\/xmlseclibs\/commit\/649032643f7aac493e91ca318da0339aec72aa4a",
                "cve": null
            }
        ]
    }
}

You can programmatically get a report with the following PHP code:

use Enlightn\SecurityChecker\SecurityChecker;

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

/*
{
  "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
    }]
  }
}
*/

The Enlightn Security Checker uses the security advisories database to reference known security vulnerabilities in PHP projects and libraries. You can learn more about this package and view the source code on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

serpapi logo
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi

The latest

View all →
Laravel AutoBuilder: Build Visual Automation Workflows image

Laravel AutoBuilder: Build Visual Automation Workflows

Read article
Pun: Format, Lint, and Analyze PHP With One Rust Binary image

Pun: Format, Lint, and Analyze PHP With One Rust Binary

Read article
Form Request Model Lookups and PHP 8.6 Support in Laravel 13.44 image

Form Request Model Lookups and PHP 8.6 Support in Laravel 13.44

Read article
Generate Laravel Validation Rules From a JSON Schema image

Generate Laravel Validation Rules From a JSON Schema

Read article
Laravel Suspicious Login: Detect and Block Risky Logins image

Laravel Suspicious Login: Detect and Block Risky Logins

Read article
Decide with Jev: Make Failed AI Requests Safe in Laravel image

Decide with Jev: Make Failed AI Requests Safe in Laravel

Read article