Skip to content

Only one workflow suppresses checkout credential persistence #1650

Closed

Description

@ptr727

actions/checkout writes the job's GITHUB_TOKEN into .git/config by default, so any later step in that job, and anything it runs, can read a credential it was never handed. Suppressing it is one line, persist-credentials: false, and it is safe wherever no step needs git authentication.

Current state

.github/workflows/canonical-review-sweep.yml sets it, because a reviewer raised it there. Every other hub workflow calling actions/checkout does not:

  • build-docker-task.yml
  • build-release-task.yml
  • check-upstream-version-task.yml
  • deploy-site-task.yml
  • get-version-task.yml
  • publish-docker-readme-task.yml
  • run-codegen-pull-request-task.yml
  • validate-task.yml

Several run under callers granting contents: write, so the persisted token there is broader than the sweep job's issues: write.

Why this is filed rather than folded in

The pull request that raised it, #1649, is about the carried-content review sweep. Those eight files sit outside its diff, and GOVERNANCE.md "Verification Discipline" says a sibling that was wrong before the change and sits in a file the diff does not touch is filed rather than folded in, because every file a diff grows into is one more that each review round reads again.

What closing this looks like

Two parts, and the first decides the second.

  • Decide whether persist-credentials: false becomes a documented convention in GOVERNANCE.md "Workflow YAML Conventions" beside the action-pinning rule. It is a real hardening rather than a style preference, and today one workflow carries it while nine do not, which is the drift a rule stated nowhere produces.
  • Where a workflow does need the persisted credential, a push or a git fetch of another ref being the cases, the flag stays off and the job says why inline, the way the concurrency exceptions already do.

The audit is per job rather than per file: a job that only reads the checked-out tree needs nothing, and actions/checkout still authenticates its own fetch through its token input regardless of this flag.

Activity

  1. added
    gate
    on Sep 16, 2026
  2. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision needed (decision triage, 2026-11-01)

    Question: Should GOVERNANCE.md "Workflow YAML Conventions" (line 266) gain a rule that every actions/checkout step sets persist-credentials: false, with a job needing the persisted token keeping it and saying why inline?

    Options, recommended first:

    1. Adopt the rule, with a per-job inline-reason exception (recommended): Real hardening at one line per step, mirrors the existing concurrency-exception pattern, and unstated rules produced the current drift. Lands as its own governance PR plus the eight-file sweep. No work in flight.
    2. Fix the eight files, no stated rule: Hardens today's workflows, but nothing stops the next one drifting. No work in flight.
    3. Leave it unruled: No cost, but any later step or action in a contents: write job can read the token from .git/config. No work in flight.

    Evidence: Only canonical-review-sweep.yml:52 (#1649) and test-pull-request.yml:38 (31c4bbd, #2555) set it. Candidate exceptions: build-release-task.yml:424 (git fetch), :448 (git ls-remote), check-upstream-version-task.yml:161 and run-codegen-pull-request-task.yml:74 (peter-evans/create-pull-request). merge-bot-task.yml pushes without actions/checkout.

    Blocks: none

  3. added
    decision
    on Nov 1, 2026
  4. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (decision triage, 2026-11-01): Option 1: add a GOVERNANCE.md 'Workflow YAML Conventions' rule that every actions/checkout step sets persist-credentials: false. A job that needs the persisted token keeps it and says why inline. Land it as its own governance PR plus the eight-file sweep. This is now work for the next burndown round.

  5. removed
    decision
    on Nov 1, 2026
  6. ptr727 commented on Nov 13, 2026

    @ptr727
    OwnerAuthor

    Backlog burndown claim (round 6, group 1, away mode): branch burndown/checkout-persist-credentials.

    Issues: #1650, per the maintainer's recorded answer (option 1): a GOVERNANCE.md "Workflow YAML Conventions" rule that every actions/checkout step sets persist-credentials: false, a job needing the persisted token keeping it and saying why inline, landed with the workflow sweep.

    Predicted file set:

    • GOVERNANCE.md
    • .github/workflows/build-docker-task.yml, .github/workflows/build-release-task.yml, .github/workflows/check-upstream-version-task.yml, .github/workflows/deploy-site-task.yml, .github/workflows/get-version-task.yml, .github/workflows/publish-docker-readme-task.yml, .github/workflows/run-codegen-pull-request-task.yml, .github/workflows/validate-task.yml, .github/workflows/test-pull-request.yml, .github/workflows/canonical-review-sweep.yml
    • catalog/snippets/workflows/test-pull-request-smoke.yml
    • docs/reusable-workflows.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions