ci/checkout-no-persist-credentials
Checkout does not leave the token on disk
| Severity | info |
| Tiers | 1 |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.5.0 |
| Selected by | fleetlint-recommended@v0.5.0 |
Requirement
Every actions/checkout step in a GitHub, Gitea or Forgejo workflow sets persist-credentials: false; a job that pushes passes its token explicitly to the push.
Why
The persisted token is readable by every later step and ends up in any artifact that includes .git.
Applies when
workflows().exists(w, ci_kind(w) != "gitlab" && steps(w).exists(s, s.uses.matches("(^|/)actions/checkout@")))Check
For each item in:
workflows().filter(w, ci_kind(w) != "gitlab").map(w,
steps(w).filter(s, s.uses.matches("(^|/)actions/checkout@")).map(s, {
"path": w,
"name": s.job,
"ok": "persist-credentials" in s.with && (s.with["persist-credentials"] == false || s.with["persist-credentials"] == "false")
})).flatten()item.okFix
Add with: { persist-credentials: false } to each checkout step; give a pushing step its own token.
Agent instruction: Add persist-credentials: false under with: of every actions/checkout step in the flagged jobs; where a later step pushes, pass the token to that step explicitly instead.
Sources
- https://github.com/actions/checkout (spec)
- https://docs.zizmor.sh/audits/ (check, artipacked)
- https://fleetlint.org/baseline/#security
Generated by fleetlint docs from catalog v0.5.0.