fleetlint Policy for a fleet of repositories
v0.11 (latest)
Getting started

ci/checkout-no-persist-credentials

Checkout does not leave the token on disk

Severityinfo
Tiers1
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.8.0
Selected byfleetlint-recommended@v0.8.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.ok

Fix

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


Generated by fleetlint docs from catalog v0.8.0.