稽核相依套件(Python)
目標:包含 requirements.txt 的資料夾(例如 ex_app/)。
cd進入目標應用程式(或使用使用者用@提及的路徑)。- 確保已安裝
pip-audit:必要時執行python -m pip install pip-audit。 - 執行
python -m pip_audit -r requirements.txt(或使用者指定的 requirements 檔案)。 - 未經詢問,請勿自動升級主版本。若使用者要求安全修復,僅在明確確認後才執行:
python -m pip_audit -r requirements.txt --fix。 - 測試:
- 若存在
pytest/tests//test_*.py→ 執行pytest(或 README 中指定的指令)。 - 若無測試套件 → 執行最少煙霧測試:解析 AST 或對主要模組執行
python -c "import …"。
- 若存在
- 摘要:發現的 CVE(若有)、已套用的修復(若有)、測試/煙霧測試的結果。
務必顯示指令的實際輸出內容(證據勝於斷言)。
若目標為 Node(package.json),請勿憑空使用 pip——請告知改用 /audit。