Skip to content

ci: fix template injections and harden the shared workflows - #248

Merged
h13 merged 3 commits into
mainfrom
ci/harden-workflows
Dec 1, 2026
Merged

h13 merged 3 commits into
mainfrom
ci/harden-workflows

Conversation

@h13

@h13 h13 commented Dec 1, 2026

Copy link
Copy Markdown
Owner

renovate-config に導入した zizmor で共有ワークフロー側も監査したところ、template-injection(HIGH)8 件を検出したため修正する。

コミット構成(各単体で green):

  1. fix: caller inputs の run ブロック直接展開を env 経由に変更 — ci-php の composer-args(env + 意図的 word splitting)と test-command(env + eval、「任意コマンド実行」の契約は維持)、ci-markdown の glob、apply-org-config の config-file。apply-org-config は利用箇所が ci-markdown の 1 箇所のみで、リモート SHA 自己ピンでは自身の修正を取り込めない構造だったため、ci-markdown にインライン化して action を削除(README の表は未記載だった setup-toolchain に差し替え)
  2. ci: 全 12 checkout に persist-credentials: false(push 系は API トークン / PAT 認証で、checkout credential は未使用と確認済み)
  3. ci: 再利用可能な ci-zizmor.yml を追加(min-severity 入力、デフォルト medium — 採用リポジトリが既存の low findings で即赤にならないように)。このリポジトリ自身は low で自己監査。self-repository 監査は actionlint が $/ 構文未対応のため理由付き ignore(renovate-config#72 と同件)

検証: actionlint green、zizmor 0 findings(45 → 0、ignore は self-repository の 2 箇所のみ)。

備考

  • actions/setup-toolchain(未使用・未文書だった)は renovate-config の .github/actions/setup と同型。統合は別途
  • dotfiles テンプレートの ci.yml が mutable な @v1 タグ(古いコミット 8472a07 を指す)参照なのは別 PR で対応予定

h13 added 3 commits December 1, 2026 19:16
Caller inputs expanded directly into run blocks (zizmor: 8 high
template-injection findings): composer-args and test-command in ci-php,
glob in ci-markdown, and config-file in apply-org-config. Inputs now
reach the shell through env; test-command keeps its run-anything
contract via eval.

apply-org-config had a single consumer (ci-markdown) and needed a
remote SHA self-pin that could never include its own latest fix, so its
fetch is inlined there and the action removed. README documents the
remaining setup-toolchain action instead.
No workflow pushes with checkout-persisted credentials: publish-node
releases via the API token and repo-sync uses its own PAT.
min-severity defaults to medium so adopting repos are not blocked by
their existing low-severity findings; this repo runs it at low. The
self-repository audit is ignored with reason: actionlint (<= 1.7.12)
rejects the suggested $/ syntax for the local workflow calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant