SKY-D293 · CI/CD pipelines
GitHub Actions persisted checkout credentials
actions/checkout saves the token it used in the checkout's .git/config by default, so later git push commands work. Every later step in the job can read it from there. SKY-D293 reports a checkout that keeps this credential when something new can reach it: an uploaded artifact, pull request code, or a third-party action next to a write token.
- Languages
- GitHub Actions workflows, composite actions
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
An artifact that includes .git/config hands the token to anyone who can download the artifact, which for a public repository is everyone. A write token read by a compromised third-party action can push to your branches or edit your releases.
What Skylos flags
name: Releaseon: push: tags: ["v*"]permissions: contents: writejobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make dist - uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 with: files: dist/*What Skylos leaves alone
name: Releaseon: push: tags: ["v*"]permissions: contents: writejobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make dist - run: gh release create "$GITHUB_REF_NAME" dist/* env: GH_TOKEN: ${{ github.token }}Why Skylos leaves it alone
The token is still saved in .git/config, but nothing new runs after the checkout: make dist is the repository's own code and gh gets the token from GH_TOKEN anyway. No third-party action and no artifact upload follow, so the saved copy reaches no one who did not already have it.
How Skylos decides
- Looks at every
actions/checkoutstep in workflow jobs and in composite actions. A checkout withpersist-credentials: false(or${{ false }}) is skipped. - Reports the checkout only when one of these is true, checked in order. A later step in the job uploads the checkout's
.git/configwithactions/upload-artifact: itspathcovers it, after globs,!exclusions and the checkout's ownpath. Uploads that skip hidden files do not count: v4.4 and later (a floating@v4counts as the newest v4) withoutinclude-hidden-files. A SHA-pinned upload's version is unknown, so it counts. - Or the checkout's
reforrepositorynames pull request code (github.event.pull_request.head…,merge_commit_sha,github.head_ref,refs/pull/…) in a job that accounts without write access can start, such as apull_request_targetjob. - Or a later step uses a third-party action (any owner other than
actionsorgithub, or adocker://image;./actions are the repository's own) while the job's token has an explicitwritescope (write-allcounts,id-tokendoes not), or the checkout uses its owntokenorssh-key, which job permissions do not limit. - In a composite action the calling job is unknown, so only the upload, or an own
tokenorssh-keywith a later third-party action, counts. A token with no declared permissions is SKY-D291's finding, not this rule's. - Reports MEDIUM on the checkout's
uses:line.
How to fix it
Set persist-credentials: false on the checkout. Steps that need the token can still be given it through env: or an input.
name: Releaseon: push: tags: ["v*"]permissions: contents: writejobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2Added: with:Added: persist-credentials: false - run: make dist - uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 with: files: dist/*When it can be wrong
- An upload pinned to a commit SHA counts as including
.git, even when that commit is v4.4 or later and skips hidden files. - A third-party action that already receives the token as an input (most release actions default to
github.token) gains nothing new from.git/config, but the checkout is still reported.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put
skylos: ignore[SKY-D293]with a reason on the checkout'suses:line or the line directly above it.YAML # skylos: ignore[SKY-D293] a later step pushes the version bump- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2A baseline (
skylos baseline ., then--baseline) also hides it. The entry is the rule, the absolute file path and the line, so it stops matching when lines above the checkout move or the checkout is at another path.[tool.skylos] ignore = ["SKY-D293"]turns the rule off for the whole project.