Skip to content

ci: scope reusable-workflow App tokens to least privilege#245

Merged
botantler[bot] merged 2 commits into
mainfrom
claude/ci-scope-app-tokens
May 27, 2026
Merged

ci: scope reusable-workflow App tokens to least privilege#245
botantler[bot] merged 2 commits into
mainfrom
claude/ci-scope-app-tokens

Conversation

@devantler
Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Assistant

What

Add explicit permission-* inputs to the six actions/create-github-app-token steps that were minting unscoped App tokens (inheriting the GitHub App's blanket installation permissions). This clears the six standing zizmor/github-app ("dangerous use of GitHub App tokens") code-scanning alerts (#170#175) on these reusable workflows.

Why

A minted App token with no permission-* inputs carries the full installation permission set, far more than any single job needs — exactly what zizmor's github-app rule flags. These six were baseline (pre-existing, non-blocking) alerts. Scoping each token to least privilege hardens every consumer of these reusable workflows at once (the supply-chain blast radius is the whole portfolio) and is consistent with the scoping already applied to update-copilot-skills.yaml in #240.

Scopes

Each token is scoped to exactly what its consuming steps need, mirroring each job's already-declared permissions: block (so the App token is never more privileged than the job's intent — additive, nothing widens):

Workflow / job permission-* added Token usage
enable-auto-merge / auto-merge contents, pull-requests gh pr review --approve, gh pr merge --auto
create-release / release contents, issues, pull-requests semantic-release (publish release/tags + comment on released issues/PRs)
sync-cluster-policies / sync-policies contents, pull-requests checkout + create-pull-request (signed commits)
validate-go-project / tidy contents, pull-requests push go mod tidy auto-fixes
validate-go-project / golangci-lint contents, pull-requests push golangci-lint auto-fixes
validate-go-project / lint contents, issues, pull-requests push MegaLinter auto-fixes + PR/issue reporting

Validation

  • actionlint clean on all four changed files — the only finding is the pre-existing code-quality unknown-scope false positive at validate-go-project.yaml (already documented in-file and ignored in CI via ACTION_ACTIONLINT_ARGUMENTS: -ignore code-quality); it is unrelated to this diff.
  • Backward-compatible: only token scope narrows; no caller interface (workflow_call inputs/secrets) changes.

Trade-offs / notes

  • create-release is scoped to the canonical semantic-release permission set (contents/issues/pull-requests) so both the Go (GoReleaser, commit-analyzer-only) and .NET (with @semantic-release/github) consumers keep working — a tighter contents-only scope would break the latter.
  • Drafted by the autonomous engineer; promote to "ready for review" when you want it driven to merge.

Add explicit permission-* inputs to the six create-github-app-token
steps that minted unscoped tokens (inheriting blanket GitHub App
installation permissions), clearing the six standing zizmor/github-app
code-scanning alerts (#170-#175).

Each token is scoped to exactly what its consuming steps need, mirroring
each job's already-declared permissions block:
- enable-auto-merge (auto-merge): contents, pull-requests
- create-release (release): contents, issues, pull-requests (semantic-release)
- sync-cluster-policies (sync-policies): contents, pull-requests
- validate-go-project (tidy, golangci-lint): contents, pull-requests
- validate-go-project (lint): contents, issues, pull-requests

Additive and backward-compatible: the token scope only narrows; no
caller interface changes. update-copilot-skills.yaml was already scoped
in #240.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 27, 2026 02:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR scopes previously unscoped GitHub App tokens in several reusable workflows by adding explicit permission-* inputs to actions/create-github-app-token, reducing token privileges and addressing zizmor github-app alerts across the workflow portfolio.

Changes:

  • Added explicit permission-* scopes to GitHub App token minting steps in multiple reusable workflows.
  • Aligned token scopes with the intended permissions needed by the downstream steps (checkout, PR operations, semantic-release).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/validate-go-project.yaml Adds explicit App token permission scoping for the auto-fix/tokenized checkout paths in tidy/lint jobs.
.github/workflows/sync-cluster-policies.yaml Scopes the App token used for checkout + create-pull-request.
.github/workflows/enable-auto-merge.yaml Scopes the App token used by gh to approve PRs and enable auto-merge.
.github/workflows/create-release.yaml Scopes the App token used by semantic-release and checkout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/validate-go-project.yaml Outdated
Comment thread .github/workflows/validate-go-project.yaml Outdated
Comment thread .github/workflows/validate-go-project.yaml Outdated
@devantler devantler marked this pull request as ready for review May 27, 2026 04:50
The App tokens in the tidy, golangci-lint, and mega-linter jobs are used
only as the git credential for checkout + git-auto-commit-action (pushing
linter auto-fixes). They are never used for PR/issue API calls — MegaLinter's
PR/issue reporting uses the default GITHUB_TOKEN, governed by the unchanged
job-level permissions block. So the App tokens need contents:write only;
drop the unused permission-pull-requests/permission-issues inputs to keep
them least-privileged (addresses the Copilot review on PR #245).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@botantler botantler Bot enabled auto-merge (squash) May 27, 2026 05:16
@botantler botantler Bot merged commit f2df968 into main May 27, 2026
36 checks passed
@botantler botantler Bot deleted the claude/ci-scope-app-tokens branch May 27, 2026 05:20
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants