- ci: add minimum required permissions to GitHub Actions workflows#150
Open
- ci: add minimum required permissions to GitHub Actions workflows#150
Conversation
Co-authored-by: mtracz <22484267+mtracz@users.noreply.github.com> Agent-Logs-Url: https://github.com/blumilksoftware/codestyle/sessions/930fe51f-969f-4f8b-ab34-dd8a75edc7b2
Copilot
AI
changed the title
[WIP] Audit and fix GitHub Actions workflows for explicit permissions
ci: add minimum required permissions to GitHub Actions workflows
Mar 25, 2026
KarolZygadlo
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.
Workflows were missing explicit
permissionsblocks, relying on GitHub's default token permissions which are overly permissive.Changes
check-pr-title.yml— addedcontents: read+pull-requests: read(PR metadata access required by the title-check action)check.yml— addedcontents: read(repo checkout only; no writes needed for lint/test)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: df68a2bf95734626ff9881d401ce93b69c5e9748)pull_request— checks PR title usingblumilksoftware/action-pr-title. Needs to read PR metadata..github/workflows/check.yml(BlobSha: 9cff3e8de7ff72266be809413c16a5c2f0c91aa5)push+pull_request— runs PHP linting and tests. No writes needed.Current file contents
check-pr-title.yml
check.yml
Instructions
permissionsblock after theon:block and beforejobs:.mainbranch.ci: add minimum required permissions to GitHub Actions workflowsThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Czy możesz wykonać pracę we wszystkich publicznych repozytoriach: https://github.com/orgs/blumilksoftware/repositories?q=visibility%3Apublic?
Czy możesz sam je zaznaczyć?
Assistant: Nie mogę “sam zaznaczyć”/wybrać wszystkich repozytoriów z tej strony ani wykonać zmian we wszystkich publicznych repozytoriach bez dwóch rzeczy:
Żeby pójść dalej, wybierz proszę jedną z opcji:
Opcja A (najszybciej)
Wklej tutaj listę repozytoriów w formacie:
blumilksoftware/repo1blumilksoftware/repo2i opisz “pracę” (np. aktualizacja dependencji, dodanie pliku, zmiana workflow, itd.).
Opcja B (ja zbiorę listę repozytoriów)
Napisz: “Tak, zbierz listę” oraz doprecyzuj “pracę”. Wtedy ja pobiorę listę publicznych repozytoriów z GitHuba i pokażę Ci ją do zatwierdzenia (bo nadal musisz potwierdzić zakres).
Pytania doprecyzowujące (żeby od razu przygotować plan/zmiany)
main/master), czy innej?Jak odpowiesz na te 3 punkty, przygotuję dokładny plan, a potem wykonam pracę repo po repo (z PR-ami), ale potrzebuję od Ciebie listy albo zgody żebym ją najpierw zebrał.
User: Validate all github actions workflows and add/adjust workflow permissions to required minimum. Check each workflow. Create one pul...
This pull request was created from Copilot chat.
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.