Jorijn / laravel-security-checker by jorijn

Added Laravel functionality to the Enlightn Security Checker. Adds a command to check for, and optionally emails you, vulnerabilities when they affect you.
1,496,424
195
8
Package Data
Maintainer Username: jorijn
Maintainer Contact: jorijn@jorijn.com (Jorijn Schrijvershof)
Package Create Date: 2017-07-20
Package Last Update: 2024-03-01
Home Page: https://jorijn.com
Language: PHP
License: MIT
Last Refreshed: 2024-04-19 15:04:37
Package Statistics
Total Downloads: 1,496,424
Monthly Downloads: 20,216
Daily Downloads: 554
Total Stars: 195
Total Watchers: 8
Total Forks: 26
Total Open Issues: 3

Laravel Security Checker

Latest Stable Version Total Downloads License Scrutinizer Code Quality Code Coverage Build Status

This package provides an effortless way for you to check your local composer.lock against the Symfony Security Advisories Checker. It can either display the results in your console or email them to you on a scheduled basis. It uses Laravel's markdown system so it should fit nicely in your styling.

Screenshot

Installation

Require this package with composer using the following command:

composer require jorijn/laravel-security-checker

After updating composer, add the service provider to the providers array in config/app.php

Jorijn\LaravelSecurityChecker\ServiceProvider::class,

Note: On Laravel 5.5 and up, this package will use auto discovery, and the above step is no longer required.

Configuration

Email

If you want the package to send reports by email, you'll need to specify a recipient.

Option 1

Add it to your .env file.

LCS_MAIL_TO="someone@example.net"
Option 2

Publish the configuration file and change it there.

php artisan vendor:publish --provider="Jorijn\LaravelSecurityChecker\ServiceProvider" --tag="config"

If you want to control on how the email is formatted you can have Laravel export the view for you using:

php artisan vendor:publish --provider="Jorijn\LaravelSecurityChecker\ServiceProvider" --tag="views"

By default, the package won't email you when there are no vulnerabilities found. You can change this setting by adding the following entry to your .env file.

LCS_NOTIFY_WITHOUT_VULNERABILITIES=true

Slack

If you want the package to send the report to a Slack channel, you will need to specify a Slack Webhook in your .env file.

E.g.:

LCS_SLACK_WEBHOOK=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Scheduling

The package exposes a new command for you:

php artisan security-check:email

You can hook it up into a regular crontab or add it into the Laravel Scheduler (app/Console/Kernel.php) like this:

protected function schedule(Schedule $schedule)
{
    $schedule->command(\Jorijn\LaravelSecurityChecker\Console\SecurityMailCommand::class)
        ->weekly();
}

Running as a command

This package provides a wrapper around the SensioLab's Security Checker command. You can call it using php artisan security-check:now.

screenshot-console

Translations

If you need to translate this package into your own language you can do so by publishing the translation files:

php artisan vendor:publish --provider="Jorijn\LaravelSecurityChecker\ServiceProvider" --tag="translations"

Please consider helping out by creating a pull request with your language to help out others.