Skip to content

enh(secu): scope the gitleaks token - #70

Merged
sc979 merged 4 commits into
mainfrom
SECU-checkout-bump-to-v7-0-1
Sep 29, 2026
Merged

sc979 merged 4 commits into
mainfrom
SECU-checkout-bump-to-v7-0-1

Conversation

@sc979

@sc979 sc979 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: SECU-1231

Description

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

Two changes to the reusable security-scan workflows:

  1. Bump actions/checkout 9c091bb (v7.0.0) → 3d3c42e5 (v7.0.1) in dependency-analysis.yml and gitleaks-analysis.yml — same as dependabot build(deps): bump actions/checkout from 7.0.0 to 7.0.1 #69.
  2. Declare a least-privilege token scope on gitleaks-analysis.yml: add a job-level permissions: contents: read. dependency-analysis.yml already declares its scopes (pull-requests: write + contents: read); gitleaks had none, so it inherited whatever the caller granted. contents: read is all the secret scan needs (checkout + read-only git).

Impact on #64 (SECU-gitleaks-custom, the gitleaks rewrite): none. A trial merge of the two branches is conflict-free, and contents: read is exactly what #64's rewritten job needs (checkout + its git fetch re-fetch loop + gitleaks detect) — no PR comment, artifact upload or SARIF write. Whichever of #64/#70 merges first, the other still applies cleanly.

🤖 Generated with Claude Code

sc979 and others added 2 commits September 21, 2026 14:24
Bump the actions/checkout pin (9c091bb # v7.0.0 -> 3d3c42e5 # v7.0.1) in the
dependency-analysis and gitleaks-analysis reusable workflows, matching
dependabot PR #69.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a job-level `permissions: contents: read` to the gitleaks reusable workflow
so its GITHUB_TOKEN is least-privilege regardless of the caller's default,
consistent with dependency-analysis.yml (which already declares its scopes) and
the per-job token-scope initiative. contents:read is all the secret scan needs
(checkout + read-only git); no PR comment, artifact upload or SARIF write.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sc979 sc979 changed the title build(deps): bump actions/checkout from 7.0.0 to 7.0.1 enh(secu): bump actions/checkout to 7.0.1 and scope the gitleaks token Sep 21, 2026
@sc979 sc979 changed the title enh(secu): bump actions/checkout to 7.0.1 and scope the gitleaks token enh(secu): scope the gitleaks token Sep 23, 2026
@sc979
sc979 marked this pull request as ready for review September 29, 2026 14:24
@sc979
sc979 requested a review from a team as a code owner September 29, 2026 14:24
@sc979
sc979 merged commit be5e5ae into main Sep 29, 2026
5 checks passed
@sc979
sc979 deleted the SECU-checkout-bump-to-v7-0-1 branch September 29, 2026 14:47
sc979 added a commit that referenced this pull request Sep 29, 2026
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>
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