Repository navigation
ci: scan dependencies for known vulnerabilities with uv audit - #14
Merged
Merged
Conversation
Run uv's preview audit command in the audit job so a dependency with a known OSV advisory fails CI. It audits every dependency group by default, including the non-default audit group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
furedea
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
CI の
auditジョブにuv audit --preview-features auditを追加し,既知の脆弱性を持つ依存があれば CI を失敗させる.既存のauditジョブは deptry と vulture(未使用の依存とコード)のみで,脆弱性スキャンはなかった(Rust テンプレートはcargo-deny,Go テンプレートはgovulncheckで実施している).変更内容
.github/workflows/ci.yml:auditジョブの末尾にRun uv auditステップを追加した.最上位のUV_LOCKED: "1"が効くため,--lockedは付けていない.justfileや CI チェックを列挙したドキュメント,AGENTS.md は存在しないため,ドキュメントは変更していない.pip-auditではなくuv auditを選んだ理由uv.lockをそのまま読む.pip-auditのようにuv exportで requirements を書き出したり,依存グループを追加したりする必要がない.https://api.osv.dev/)で,PyPI Advisory(PYSEC)と GHSA を含む.PreviewFeature::AuditCommand)であり,フラグ名,出力,終了コードが予告なく変わりうる.uv を上げたときにこのステップが壊れた場合は,CI の失敗で検知できる.グループの扱い
既定のまま全グループを監査する.uv 0.13.5 の
uv auditには--all-groupsがなく,既定で全グループが対象になる.default-groupsに含まれないauditグループの deptry と vulture の依存も含む)--no-group audit: 11 パッケージ--no-default-groups: 0 パッケージ開発用ツールも CI で実行されるため,サプライチェーンの対象として監査に含める.
uv のバージョン確認
uv auditがあることを確認した.フラグなしでは--preview-features audit-commandを勧める警告が出る.alias のauditでも警告なしで有効になる.uv auditreports "no known vulnerabilities" (exit 0) when the OSV querybatch response has fewer results than queries astral-sh/uv#22102(OSV の querybatch 応答が問い合わせより少ないとき「脆弱性なし」で終了 0 になる問題)は修正されていない.報告者自身が「実際の環境では未観測で,応答を操作できる者は元から検出結果を隠せるためセキュリティ境界ではない」としてクローズした.main のcrates/uv-audit/src/service/osv.rsも件数を照合しないzipのままである.そのため,バージョンを上げても得るものはなく,0.13.5 のままにした.本プロジェクトの依存数(16)はバッチ上限(1,000)を大きく下回る.検証
devShell の uv 0.13.5 で,
api.osv.devへの接続を許可して実行した.UV_LOCKED=1 uv audit --preview-features audit: 16 パッケージに既知の脆弱性なし,終了コード 0jinja2==2.10を依存に持つ使い捨てプロジェクト:12 件を検出し,終了コード 1(既知の脆弱性があれば CI が失敗することを確認)レビュー
Codex による読み取り専用のレビューを 1 回実施した.P0〜P3 の指摘はなし(actionlint も Codex 側で通過).
🤖 Generated with Claude Code