Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/public-repo-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false
Comment on lines +46 to +47

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Shared copy of the security-gate workflow still leaves the job credential on disk

The hardening step that stops the job's credential from being written to disk (persist-credentials: false at .github/workflows/public-repo-guard.yml:46-47) was added only to this repo's own copy and not to the shared template other repositories install from, so every repo that copies the gate keeps the old, unhardened behavior.
Impact: Repos adopting the published guard template continue to expose the build credential to later steps, so the fix does not actually reach the repos it was meant to protect.

Divergence between the live workflow and the vendored workflow template

workflow-templates/public-repo-guard.yml is the copy the org's "install on a new repo" flow uses (the header at .github/workflows/public-repo-guard.yml:16-19 instructs copying the workflow file alongside .gitleaks.toml and scripts/public-repo-guard/content-policy.sh). A diff of the two files shows the only difference is the two newly added lines; workflow-templates/public-repo-guard.yml:45 still has a bare - uses: actions/checkout@... with no with: block.

Prompt for agents
The PR adds `with: persist-credentials: false` to the checkout step in .github/workflows/public-repo-guard.yml but the identical vendored copy at workflow-templates/public-repo-guard.yml (the file other repos install) was not updated. Apply the same change there so the two stay in sync; also consider whether the other workflow templates that call actions/checkout need the same hardening.
Open in Devin Review

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

Comment on lines 45 to +47

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Same hardening missing on other org workflows using checkout

A repo-wide grep shows persist-credentials appears only in the file changed by this PR. Other workflows (.github/workflows/issue-ops-triage.yml, .github/workflows/ticket-hygiene.yml) and several workflow-templates/*.yml also use actions/checkout without it. Some of those legitimately need the token, but a follow-up sweep would make the hardening consistent org-wide.

Open in Devin Review

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

Comment on lines +46 to +47

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟨 Distributed guard workflow template still persists the job credential in .git/config

The hardening (persist-credentials: false) was applied only to .github/workflows/public-repo-guard.yml:46-47; the vendored copy at workflow-templates/public-repo-guard.yml:45, which is the version other repositories install, still checks out with credentials persisted. Any repo using that template continues to leave GITHUB_TOKEN readable in .git/config for subsequent steps, including the step that downloads and executes the gitleaks binary.

Open in Devin Review

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

@cubic-dev-ai cubic-dev-ai Bot Aug 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The credential-persistence fix (persist-credentials: false) was added here but the vendored template at workflow-templates/public-repo-guard.yml, which other repositories copy when installing this guard, still has a bare actions/checkout step with no with: block. Repos that install from that template will continue to leave GITHUB_TOKEN in .git/config for the same gitleaks-download step this PR is hardening. Apply the same persist-credentials: false change to workflow-templates/public-repo-guard.yml.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/public-repo-guard.yml, line 47:

<comment>The credential-persistence fix (persist-credentials: false) was added here but the vendored template at workflow-templates/public-repo-guard.yml, which other repositories copy when installing this guard, still has a bare `actions/checkout` step with no `with:` block. Repos that install from that template will continue to leave GITHUB_TOKEN in `.git/config` for the same gitleaks-download step this PR is hardening. Apply the same `persist-credentials: false` change to workflow-templates/public-repo-guard.yml.</comment>

<file context>
@@ -43,6 +43,8 @@ jobs:
     steps:
       - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd  # v5.0.1
+        with:
+          persist-credentials: false
 
       # gitleaks' GitHub Action requires a paid license for organizations; the CLI
</file context>
Fix with cubic


# gitleaks' GitHub Action requires a paid license for organizations; the CLI
# itself is MIT-licensed and free. Pin the version AND verify the release
Expand Down