Skip to content

fix(ci): do not persist the job token in .git/config in the public-repo guard - #28

Closed
yakimoto wants to merge 1 commit into
mainfrom
fix/1870-persist-credentials-false
Closed

fix(ci): do not persist the job token in .git/config in the public-repo guard#28
yakimoto wants to merge 1 commit into
mainfrom
fix/1870-persist-credentials-false

Conversation

@yakimoto

@yakimoto yakimoto commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Why

actions/checkout without persist-credentials: false writes the job's GITHUB_TOKEN into
.git/config, where any later step — or anything those steps execute — can read it. This is the
security gate that DOWNLOADS AND EXECUTES the gitleaks binary, and the workflow's own comment
already reasons about tampered downloads ("so a tampered or MITM'd download can never execute
inside the security gate"), so the threat model is written down and only the credential half of
the mitigation is missing. Found by zizmor as warning[artipacked]: credential persistence through GitHub Actions artifacts.

Safety

Verified this job only: checks out, installs gitleaks (pinned + checksum), runs
gitleaks detect --no-git, installs ripgrep, runs content-policy.sh. permissions: contents: read. Nothing pushes, calls gh, or reads GITHUB_TOKEN/GH_TOKEN, so the token was never needed
in .git/config in the first place.

Refs wave-av/claude-workstation#1870.


Note

Cursor Bugbot is generating a summary for commit a925ae0. Configure here.

Note

Stop persisting the job token in .git/config in the public-repo guard CI workflow

Sets persist-credentials: false on the actions/checkout step in public-repo-guard.yml so the GitHub job token is not written to the local git config during the workflow run.

Macroscope summarized a925ae0.

Review in cubic

…po guard

actions/checkout without persist-credentials:false leaves GITHUB_TOKEN readable
in .git/config for every later step — including the one that downloads and
executes the gitleaks binary. Nothing in this job uses the credential
(contents:read, gitleaks runs --no-git, no gh/push steps). Refs #1870.
@cursor

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_95a2221e-a844-4add-af30-650510d2e165)

@macroscopeapp

macroscopeapp Bot commented Aug 6, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved a925ae0

This is a minor CI security hardening change that prevents the job token from being persisted in git config - a standard best practice. The author is the designated code owner of this workflow file.

You can customize Macroscope's approvability policy. Learn more.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines 45 to +47
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Installation instructions unchanged but hardening is workflow-local

The header comment (lines 16-19) instructs copying the three guard files into other repos verbatim. This hardening change lives only in this repo's copy; sibling public repos that already vendored the workflow will keep persisting the job token unless the same edit is propagated. Consider syncing the change across the other repos that vendored this guard.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

CI: prevent GITHUB_TOKEN persistence in public-repo guard checkout

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Disable credential persistence during checkout in the public-repo guard job.
• Prevent GITHUB_TOKEN from being written into .git/config for later steps.
• Reduce risk when downloading/executing pinned security tooling (e.g., gitleaks).
Diagram

graph TD
  A["public-repo-guard job"] --> B["actions/checkout"] --> C["repo working tree"] --> D["download + run tools"]
  B --> E[".git/config"]
  F{"persist-credentials: false?"}
  B --> F
  F -->|yes| G["no token stored"]
  F -->|no| H["GITHUB_TOKEN stored"]
  subgraph Legend
    direction LR
    _job([Job/Step]) ~~~ _file["Config file"] ~~~ _dec{Decision}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Skip checkout in the guard job
  • ➕ Eliminates git credential persistence and git metadata entirely in the security gate
  • ➖ Often impractical if policy scripts or repo files are required
  • ➖ May require reworking steps to fetch only needed files
2. Post-checkout token scrubbing
  • ➕ Can remediate credential persistence even if a misconfigured checkout is used
  • ➖ More brittle; must track all places tokens can be stored (extraheader, credential helpers, etc.)
  • ➖ Token is briefly available between checkout and scrub step
3. Use a separate minimal-permissions token / OIDC flow
  • ➕ Further limits impact if a token is exposed
  • ➖ More complex setup; likely unnecessary here given contents:read and no token need

Recommendation: Keep the current approach (persist-credentials: false) as the primary mitigation: it prevents the token from ever being written to .git/config and aligns with the job’s threat model (downloading/executing tooling). Alternatives either add complexity (scrubbing or token redesign) or require larger workflow changes (no checkout).

Files changed (1) +2 / -0

Other (1) +2 / -0
public-repo-guard.ymlDisable actions/checkout credential persistence in public-repo guard +2/-0

Disable actions/checkout credential persistence in public-repo guard

• Configures the checkout step with persist-credentials: false so the job’s GITHUB_TOKEN is not written into .git/config. This reduces exposure to later steps executed within the same job.

.github/workflows/public-repo-guard.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

Qodo Fixer

No findings are available for this PR yet. Findings appear here once Qodo has reviewed the PR.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@yakimoto

yakimoto commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

This PR is redundant with #25 (chore/guard-canonical-sync), which is already open and already contains this exact change.

Evidence — #25's diff to .github/workflows/public-repo-guard.yml includes:

+          # tree. Nothing here pushes -- the scan is `--no-git` over the working tree --
+          # so no step needs authenticated Git; drop it. (zizmor: artipacked)
+          persist-credentials: false

#25 is also broader than this PR: it syncs the whole vendored public-repo-guard trio to
the canonical source (wave-foundation/scaffolder/public-repo-guard) byte-for-byte, verified by
git blob SHA, rather than adding this one line in isolation.

Closing as redundant. This duplicate exists because the fan-out that opened this PR
(refs claude-workstation#1870) did not check for in-flight PRs touching the same file before
going out — #25 was already open. Merge #25 instead.

@yakimoto yakimoto closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant