LoginSignup
4
5

More than 1 year has passed since last update.

pythonのライブラリの脆弱性チェックをやってみた

Posted at

requirements.txtなどでライブラリをバージョンを指定するとそのままにしていることが多い気がしたので、
ライブラリの脆弱性チェックの方法を確認してみました

今回は古めのDjangoをrequirements.txtに記載し実行してみました

safety

git hub
https://github.com/pyupio/safety

Safety DBを使用し脆弱性のチェックを行う
https://github.com/pyupio/safety-db

インストール

pip install safety

実行

safety check -r requirements.txt

結果

2022-09-30-17-21-19.png

24 vulnerabilities foundが脆弱性の数で、VULNERABILITIES FOUNDからが脆弱性の情報になります

pip-audit

git hub
https://github.com/pypa/pip-audit

Python Packaging Advisory Databaseを使用し脆弱性のチェックを行う
https://github.com/pypa/advisory-database

インストール

pip install pip-audit

実行

pip-audit -r requirements.txt --desc

結果

Found 20 known vulnerabilities in 1 package
Name   Version ID                  Fix Versions               Description
------ ------- ------------------- -------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
django 1.7.5   PYSEC-2019-16       1.11.27,2.2.9              Django before 1.11.27, 2.x before 2.2.9, and 3.x before 3.0.1 allows account takeover. A suitably crafted email address (that is equal to an existing user's email address after case transformation of Unicode characters) would allow an attacker to be sent a password reset token for the matched user account. (One mitigation in the new releases is to send password reset tokens only to the registered user email address.)

Found 20 known vulnerabilities in 1 packageが脆弱性の数で、その下からが脆弱性の情報になります
数が多いので、全部は表示していません

終わり

数だけを見るとsafetyのほうが多かったですね
あとは反映スピードなどが気になります

今回はrequirements.txtに記載してあるライブラリのチェック方法を記載していましたが、
インストールしてあるライブラリのチェック方法もありますので気になる方は確認してみてください

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5