合同会社FoodIT

PHPのプロジェクトには入れておこう! Local PHP Security Checker

post-cover

LocalPHPSecurityCheckerとは?

引用 The Local PHP Security Checker is a command line tool that checks if your PHP application depends on PHP packages with known security vulnerabilities. It uses the Security Advisories Database behind the scenes.

deppl Local PHP Security Checker は、お使いの PHP アプリケーションが既知のセキュリティ脆弱性を持つ PHP パッケージに依存しているかどうかをチェックするコマンドラインツールです。裏側で Security Advisories Database を使用します。

要は?

  • PHPで利用するパッケージのセキュリティ脆弱性を確認してくれます。
  • バックエンドデータベースには Security Advisories Database が利用されます。

なかなかセキュリティって言っても取っ付きにくいし、あまり考えたくない。そんなエンジニアの一人ですが。。。

BtoB / BtoCのサービスを提供していくと最低限の品質を保たなければいけません!

そんなあなたに簡単にセキュリテイチェックの一つを!

使い方!(以下はM1 Mac版です) 最新ファイルや各種ディストリビューションについては こちらをみてくださいね。

$ wget https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.4/local-php-security-checker_2.0.4_linux_arm64
$ mv local-php-security-checker_2.0.4_linux_arm64 /usr/local/bin/local-php-security-checker
$ chmod 755 /usr/local/bin/local-php-security-checker

使ってみる!

以下、うちで作っているものすごい古いツールに対して実行した結果です。

Symfony Security Check Report
=============================

1 package has known vulnerabilities.

laravel/framework (v8.42.1)
---------------------------

 * [CVE-2021-43617][]: Image upload bypass
 * [CVE-2021-43808][]: Possible cross-site scripting (XSS) vulnerability in the Blade templating engine

[CVE-2021-43617]: https://github.com/laravel/framework/pull/39666
[CVE-2021-43808]: https://github.com/laravel/framework/security/advisories/GHSA-66hf-2p6w-jqfw

ぞろぞろCVE-と出てきましたね。。。

$ local-php-security-checker ./
Symfony Security Check Report
=============================

No packages have known vulnerabilities.

Note that this checker can only detect vulnerabilities that are referenced in the security advisories database.
Execute this command regularly to check the newly discovered vulnerabilities.

Updateして改善しましょう。※ちゃんと依存関係のある パッケージ もみてね。

今後の使い道

GitHub ActionなどCIを回すときに local-php-security-checker を回せるとよりよくセキュア対応ができますね。

本家

Local PHP Security Checker

© 2022 xshsaku foodit.co.jp