You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security.yml: gitleaks fails every pull request because GITHUB_TOKEN is not passed #2740
.github/workflows/security.yml runs gitleaks/gitleaks-action on pull_request, but the step does not pass GITHUB_TOKEN. On every pull request the action stops before scanning any commit:
🛑 GITHUB_TOKEN is now required to scan pull requests.
So the secret scan fails on every PR, whatever the PR contains, and a red check that is always red stops meaning anything.
Seen where
A private copy of the repo, on release 8.761.0's security.yml, across four consecutive PRs. Push events to main are not affected, since the action only needs the token for pull_request.
What fixed it there
Two additions, each made after the error it answers:
permissions:
contents: readpull-requests: read # with only contents: read, the action stopped at "Resource not accessible by integration" while listing the PR's commits
- name: Run gitleaksuses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
With both, the secret scan passes on PRs. I have not checked whether a public repo also needs pull-requests: read; the GITHUB_TOKEN requirement comes from the action itself (see its README usage example).
Answering the open question at the end, because the file settles it — security.yml @ f6ab5e0228bfb356c82edbf52b69344dbd585486.
Yes, the public repo needs pull-requests: read too, and the reason is stronger than the private case.security.yml:13-14 already declares an explicit block:
permissions:
contents: read
Once a workflow declares permissions: at all, every scope it does not list is set to none for that run — it does not fall back to the repository or organisation default. So pull-requests is none by construction here, and it would be none even if the repository default were permissive. The public/private question does not enter into it: the block is in the file, not in the policy.
Which means the two additions you made in the private copy are both required, at these loci:
security.yml:13-14 — add pull-requests: read next to contents: read.
security.yml:28 — add GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} to the env: of the Run gitleaks step. The action needs the token to enumerate the PR commits, and the env: at :28-32 currently carries only GITLEAKS_ENABLE_UPLOAD_ARTIFACT and GITLEAKS_VERSION.
What does not need to change. The rest of the workflow is already in the shape you would want for a public repo:
All four uses: are SHA-pinned with the tag as a comment — actions/checkout@11d5960a…:22, gitleaks/gitleaks-action@ff98106e…:27, actions/checkout@11d5960a…:39, oven-sh/setup-bun@0c5077e5…:44.
SENSITIVE_TERMS reaches the scan through env: at :55, not interpolated into the run: string at :49. That is the distinction that matters for a secret in a public workflow, and it is already on the right side of it — so correcting the gitleaks gate does not put it at risk.
The sensitive-content job at :34 declares no permissions: of its own; it inherits the root contents: read, which is all it needs.
One adjacent observation, since it is the same class of problem and it is not in this file: the only floating refs left in the repo are in .github/workflows/claude-code-review.yml and .github/workflows/claude.yml — actions/checkout@v4 and anthropics/claude-code-action@v1 in each. Everything a pull_request triggers is pinned; the two workflows that hold a mutable ref are the ones that are not part of this gate.
Nothing changed on my side; this is read-only measurement of the public tree.
🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks @drpaulobernardy, you found that security.yml runs gitleaks on pull requests without GITHUB_TOKEN, so it fails every PR. Our release check now flags a token-less gitleaks job, and the workflow file itself gets the token and the pull-requests permission as part of the next release.
This fix lands in the next LifeOS release, so I'm closing this now.
Activity
alexisromtz-lab commentedon Nov 11, 2026
Answering the open question at the end, because the file settles it —
security.yml @ f6ab5e0228bfb356c82edbf52b69344dbd585486.Yes, the public repo needs
pull-requests: readtoo, and the reason is stronger than the private case.security.yml:13-14already declares an explicit block:Once a workflow declares
permissions:at all, every scope it does not list is set tononefor that run — it does not fall back to the repository or organisation default. Sopull-requestsisnoneby construction here, and it would benoneeven if the repository default were permissive. The public/private question does not enter into it: the block is in the file, not in the policy.Which means the two additions you made in the private copy are both required, at these loci:
security.yml:13-14— addpull-requests: readnext tocontents: read.security.yml:28— addGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}to theenv:of theRun gitleaksstep. The action needs the token to enumerate the PR commits, and theenv:at:28-32currently carries onlyGITLEAKS_ENABLE_UPLOAD_ARTIFACTandGITLEAKS_VERSION.What does not need to change. The rest of the workflow is already in the shape you would want for a public repo:
uses:are SHA-pinned with the tag as a comment —actions/checkout@11d5960a…:22,gitleaks/gitleaks-action@ff98106e…:27,actions/checkout@11d5960a…:39,oven-sh/setup-bun@0c5077e5…:44.SENSITIVE_TERMSreaches the scan throughenv:at:55, not interpolated into therun:string at:49. That is the distinction that matters for a secret in a public workflow, and it is already on the right side of it — so correcting the gitleaks gate does not put it at risk.sensitive-contentjob at:34declares nopermissions:of its own; it inherits the rootcontents: read, which is all it needs.One adjacent observation, since it is the same class of problem and it is not in this file: the only floating refs left in the repo are in
.github/workflows/claude-code-review.ymland.github/workflows/claude.yml—actions/checkout@v4andanthropics/claude-code-action@v1in each. Everything apull_requesttriggers is pinned; the two workflows that hold a mutable ref are the ones that are not part of this gate.Nothing changed on my side; this is read-only measurement of the public tree.
danielmiessler commentedon Nov 18, 2026
Note
🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks @drpaulobernardy, you found that security.yml runs gitleaks on pull requests without GITHUB_TOKEN, so it fails every PR. Our release check now flags a token-less gitleaks job, and the workflow file itself gets the token and the pull-requests permission as part of the next release.
This fix lands in the next LifeOS release, so I'm closing this now.