Skip to content

fix(secu): restore gitleaks scan on pull requests - #72

Merged
sc979 merged 1 commit into
mainfrom
SECU-1231-addPullRequestsRead
Sep 29, 2026
Merged

sc979 merged 1 commit into
mainfrom
SECU-1231-addPullRequestsRead

Conversation

@sc979

@sc979 sc979 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: SECU-1231

Description

What are your needs or what are you planning to do in this PR?

Since #70 scoped the gitleaks job token to contents: read, every pull_request run fails before scanning with 403 Resource not accessible by integration. On PR events, gitleaks-action first lists the PR commits (GET /repos/{owner}/{repo}/pulls/{n}/commits) to build the scan range, and GitHub answers with x-accepted-github-permissions: pull_requests=read (seen on centreon/WebApp-corporate-website#115).

This PR adds pull-requests: read next to contents: read in the job permissions. No write scope is needed: PR comments, artifact upload and job summary stay disabled.

  • push runs: unaffected. They take the commit range from the event payload and never call the pulls API.
  • Callers: a reusable workflow can only narrow the caller's token. A caller that declares its own permissions: block without pull-requests: read will still get the 403 and needs the scope added on its side.

🤖 Generated with Claude Code

Since #70 scoped the gitleaks job token to `contents: read`, every
pull_request run fails with a 403 before scanning: gitleaks-action lists
the PR commits (GET /repos/{owner}/{repo}/pulls/{n}/commits) to build the
scan range, and that endpoint requires `pull-requests: read`.

Grant that read scope alongside `contents: read`. No write scope is
needed: PR comments, artifact upload and job summary stay disabled. Push
runs are unaffected, they take the commit range from the event payload.

Refs: SECU-1231

Assisted-by: Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sc979
sc979 marked this pull request as ready for review September 29, 2026 15:10
@sc979
sc979 requested a review from a team as a code owner September 29, 2026 15:11
@sc979
sc979 merged commit 7ed7ccb into main Sep 29, 2026
5 checks passed
@sc979
sc979 deleted the SECU-1231-addPullRequestsRead branch September 29, 2026 15:17
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