Actionsのセキュリティチェックを追加する - #25
Merged
Merged
Conversation
zizmor でワークフロー自体のセキュリティ上の問題を検査する。 .github/ 配下の変更があったときだけ走る。 判定方針は .github/zizmor.yml に書き下す。GitHub 公式(actions/*)と 自社(CALIL/*)はタグ指定を許容し、第三者のアクションはコミットSHA固定を必須とする。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deploying openbookcamera with
|
| Latest commit: |
17b7822
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9a9ddd56.openbookcamera.pages.dev |
| Branch Preview URL: | https://chore-actions-security-check.openbookcamera.pages.dev |
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.
このPRでやること
Actionsのセキュリティチェックをこのリポジトリに追加します。
.github/配下を変更したときだけ走り、ワークフロー自体に潜むセキュリティ上の問題を zizmor で検査します。
追加するファイルは2つです。
.github/workflows/actions-security-check.yml.github/zizmor.yml何を見てくれるのか
代表的なものだけ挙げます。
unpinned-usesartipackedactions/checkoutが既定で書き込み権限つきトークンを.gitに残す。成果物に混ざると漏れるexcessive-permissionsGITHUB_TOKENに必要以上の権限を渡しているtemplate-injectionrun:にテンプレート式を直書きしている。PRのタイトルなど外部から書ける値が混ざるとコマンドを差し込まれる判定の方針
actions/*(GitHub 公式)CALIL/*(自社)第三者のアクションを新しく使うときはこう書きます。
SHA は
gh api repos/foo/bar/commits/v1.2.3 --jq .shaで取れます。Dependabot はこの形式を認識し、更新時に SHA とコメントの両方を書き換えます。
落ちたときの読み方
チェックが落ちると、GitHub の Annotations に該当行と理由が出ます。
さらにワークフローの実行画面の下に、ルールごとの直し方の表が出るようにしてあります。
意図的にその書き方をしている場合は、該当行に次のコメントを付けて外せます。
確認したこと
zizmor v1.28.0で確認).github/**を変えるのでチェック自身が走る。このPRのチェックが緑になれば導入完了です