- ci: add minimum required permissions to GitHub Actions workflows#582
Merged
- ci: add minimum required permissions to GitHub Actions workflows#582
Conversation
Co-authored-by: mtracz <22484267+mtracz@users.noreply.github.com> Agent-Logs-Url: https://github.com/blumilksoftware/toby/sessions/728c06b0-9cc0-4f3e-b31b-29dea69995e4
Copilot
AI
changed the title
[WIP] Audit and fix GitHub Actions workflows for permissions
- ci: add minimum required permissions to GitHub Actions workflows
Mar 25, 2026
EwelinaSkrzypacz
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All 6 workflows lacked explicit
permissionsblocks, defaulting to overly permissive GITHUB_TOKEN scopes. Adds least-privilegepermissionsto each workflow based on what it actually needs.Changes
check-pr-title.yml—contents: read+pull-requests: read(reads PR metadata)test-and-lint-js.yml—contents: read(checkout only)test-and-lint-php.yml—contents: read(checkout only)deploy-to-beta-manually.yml—contents: read(checkout + Docker/SSH deploy, no token writes)deploy-to-prod.yml—contents: read(same as beta)run-command-on-beta.yml—permissions: {}(SSH only, never checks out code)Original prompt
Goal
Audit and fix all GitHub Actions workflows in
.github/workflows/by adding explicitpermissionsblocks with the minimum required permissions. This follows the security best practice of least-privilege (principle of minimal permissions).Security principles to apply
permissionsblocks with only what each workflow truly needs.Workflows to fix
.github/workflows/check-pr-title.yml(BlobSha: ef659ac254b7040788c3525543b29ab4ca7b6f65)pull_request— checks PR title usingblumilksoftware/action-pr-title. Needs to read PR metadata..github/workflows/test-and-lint-js.yml(BlobSha: 2ff180ed40190dfcc4001f3debafe334536dc56d)pull_request— lint/test JS, no writes needed..github/workflows/test-and-lint-php.yml(BlobSha: bc473654fad92d685ee99bb433d8e6d0888b6f86)pull_request— lint/test PHP, no writes needed..github/workflows/deploy-to-beta-manually.yml(BlobSha: 2b1fa8574b689e979e9d02d3b579cafaf53d4e61)workflow_dispatch— builds Docker, pushes to external registry, deploys via SSH. No GITHUB_TOKEN writes needed..github/workflows/deploy-to-prod.yml(BlobSha: b383c8ddbc2c74e781d39978eeb8310bb96e6f71)pushon tags — same as deploy-to-beta but to production..github/workflows/run-command-on-beta.yml(BlobSha: 1a44179adbe92ad2769f0ad18df89f52ff36e8e8)workflow_dispatch— only runs SSH command, does NOT checkout code, does NOT need GITHUB_TOKEN at all.Current file contents
check-pr-title.yml
test-and-lint-js.yml
test-and-lint-php.yml