Skip to content

CI: Restrict workflow permissions - #64

Merged
brawer merged 1 commit into
mainfrom
ci-permissions
Jan 23, 2026
Merged

CI: Restrict workflow permissions#64
brawer merged 1 commit into
mainfrom
ci-permissions

Conversation

@brawer

@brawer brawer commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/diffed-places/diffed-places-pipeline/security/code-scanning/1

In general, to fix this class of issue you add a permissions: block to the workflow or to each job to explicitly define the minimal scopes the GITHUB_TOKEN should have. For a test/build workflow that only needs to read the repository contents, contents: read is usually sufficient.

For this specific workflow, the simplest non‑breaking fix is to add a root‑level permissions: block just under the name: (or immediately after the on: block) that sets contents: read. This will apply to all jobs that don’t define their own permissions:. None of the steps in the build job require write access (they only check out code and run cargo commands locally), so this change does not affect existing functionality.

Concretely, in .github/workflows/test.yml, insert:

permissions:
  contents: read

near the top of the file (e.g., after line 2 or after the on: block). No additional imports or methods are needed; this is purely a YAML configuration change.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@brawer brawer changed the title Potential fix for code scanning alert no. 1: Workflow does not contain permissions CI: Fix workflow permissions Jan 23, 2026
@brawer brawer changed the title CI: Fix workflow permissions CI: Restrict workflow permissions Jan 23, 2026
@brawer
brawer marked this pull request as ready for review January 23, 2026 09:41
@brawer
brawer merged commit 7b821c5 into main Jan 23, 2026
1 check passed
@brawer
brawer deleted the ci-permissions branch January 23, 2026 09:42
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