Skip to content

Add contents read permission to all GitHub Actions workflows - #1076

Merged
BYVoid merged 1 commit into
masterfrom
claude/add-workflow-permissions-7oNQ7
Mar 27, 2026
Merged

BYVoid merged 1 commit into
masterfrom
claude/add-workflow-permissions-7oNQ7

Conversation

@BYVoid

@BYVoid BYVoid commented Mar 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR adds explicit permissions: contents: read declarations to all GitHub Actions workflow jobs to follow the principle of least privilege and improve security posture.

Key Changes

  • Added permissions: contents: read to the following workflow jobs:
    • python.yml: unit-test and test-pypi jobs
    • bazel.yml: build-and-test job
    • check-dictionary-sorted.yml: sort-check job
    • cmake.yml: build-and-test job
    • mingw.yml: build job
    • msvc.yml: build-and-test job
    • nodejs.yml: build-and-test job

Implementation Details

Each job now explicitly declares that it requires read access to repository contents, which is necessary for the actions/checkout step and other operations that read the repository. This follows GitHub's security best practice of using minimal required permissions rather than relying on default permissions.

Following the pattern from PR #1074, add `permissions: contents: read`
to all workflow jobs that only need read access. The release-winget
workflow already has appropriate write permissions.

https://claude.ai/code/session_01PH4HxLHfpWeSNSS1MvK6f9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 tightens GitHub Actions job token permissions by explicitly setting permissions: contents: read on CI jobs, aligning workflows with least-privilege guidance while still allowing actions/checkout to function.

Changes:

  • Added permissions: contents: read to CI jobs across Python, Node.js, CMake, Bazel, MSVC, MinGW, and dictionary-sort check workflows.
  • Standardized per-job permission declarations instead of relying on implicit defaults.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/python.yml Adds contents: read to unit-test and test-pypi jobs.
.github/workflows/nodejs.yml Adds contents: read to build-and-test job.
.github/workflows/msvc.yml Adds contents: read to build-and-test job.
.github/workflows/mingw.yml Adds contents: read to build job.
.github/workflows/cmake.yml Adds contents: read to build-and-test job.
.github/workflows/check-dictionary-sorted.yml Adds contents: read to sort-check job.
.github/workflows/bazel.yml Adds contents: read to build-and-test job.

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

Comment on lines +15 to +16
permissions:
contents: read

Copilot AI Mar 27, 2026

Copy link

Choose a reason for hiding this comment

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

The PR title/description say this adds permissions: contents: read to all workflows, but the repo also contains release workflows (e.g. release-pypi.yml already has contents: read, and release-winget.yml uses contents: write). Consider adjusting the PR title/description to clarify scope (e.g. “all CI workflows” or “all non-release jobs”) so it matches what’s actually changed.

Copilot uses AI. Check for mistakes.
@BYVoid
BYVoid merged commit a211b5e into master Mar 27, 2026
35 of 37 checks passed
Copilot AI mentioned this pull request Apr 17, 2026
3 tasks done
@frankslin
frankslin deleted the claude/add-workflow-permissions-7oNQ7 branch April 19, 2026 01:45
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.

3 participants