Lesson 7 of 9 · 21m
Reviewing Pipeline as Code Like Production Code
Review workflow changes for security boundary shifts, behavior changes, reproducibility, cost, and operability rather than YAML syntax alone.
Pipeline definitions often get less review than application code despite having broader powers. They can read secrets, publish artifacts, deploy production, mutate infrastructure, and run attacker-influenced code. Then we act surprised when a one-line YAML change becomes a supply-chain incident. Pipeline as code deserves production-grade review because it is production control code.
Review the trust boundary first
Ask these questions before syntax:
What new code can execute?
On which runner and network identity?
With which secrets or permissions?
For which branch, fork, tag, or actor?
What artifacts or deployments can it influence?A harmless-looking pull_request_target workflow is not harmless. It runs in the context of the target repository while processing code or metadata from a fork. That combination requires deliberate isolation.
Demand pinned actions and tools
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0Pinning to a commit reduces silent mutation risk. Tags can move. The tradeoff is update friction, so pair pinning with dependency automation and review. A floating main action reference in a privileged workflow is a deliberate acceptance of remote code change.
Small diffs can change semantics
Examples reviewers must catch:
# before: tests only
run: npm test
# after: arbitrary lifecycle scripts execute during install
run: npm install && npm testAnother classic:
env:
TOKEN: ${{ secrets.DEPLOY_TOKEN }}Adding that environment variable to a job can expose it to every process and log stream in the job, even if only one step needs it. Scope secrets to the smallest step possible.
Require evidence in the pull request
For nontrivial workflow changes, the PR should state what was tested, whether secrets were available, whether fork behavior changed, whether required checks still gate merges, and what cost or runtime impact is expected. If workflow syntax does not execute until merge, test it on a branch or in a sandbox repository when possible.
Ownership and CODEOWNERS
Restrict review for workflow, runner, deployment, and release files:
/.github/workflows/ @platform-team
/deploy/ @platform-team @release-managers
/infra/ @infrastructure-teamOwnership does not mean the platform team authors everything. It means people accountable for blast radius review boundary changes.
Field notes
- Search for indirect execution: Makefile targets, package scripts, reusable workflows, composite actions, and generated config.
- Treat runner image changes as pipeline changes; a new compiler or preinstalled credential helper alters behavior.
- Review log output as well as success state. Secret masking is not a design substitute.
- Reject opaque copied workflow blocks. If nobody can explain a line, it does not belong in the release path.
Was this lesson helpful?