Skip to content

Potential fix for code scanning alert no. 2: Workflow does not contain permissions#12

Merged
rossaddison merged 1 commit intomasterfrom
alert-autofix-2
Dec 20, 2025
Merged

Potential fix for code scanning alert no. 2: Workflow does not contain permissions#12
rossaddison merged 1 commit intomasterfrom
alert-autofix-2

Conversation

@rossaddison
Copy link
Owner

Potential fix for https://github.com/rossaddison/data-cycle/security/code-scanning/2

In general, this problem is fixed by explicitly adding a permissions block to the workflow (at the root level or per job) to restrict the GITHUB_TOKEN to the least privileges required. For read-only CI checks (like composer-require-checker) that do not need to modify repository resources, contents: read is typically sufficient; in many cases you can even set permissions: read-all or permissions: {} (no permissions) if the checks don’t use the token at all.

For this specific workflow, the best minimal change without altering functionality is to add a root-level permissions section just after the name: field. Composer require checking normally only needs to read the repository to install dependencies and run analysis, and does not need to write to issues, PRs, or the contents API, so we can safely set contents: read. This root-level block will apply to the composer-require-checker job, since it has no job-specific permissions. No additional methods, imports, or definitions are needed because this is a pure YAML configuration change in .github/workflows/composer-require-checker.yml.


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

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@rossaddison rossaddison marked this pull request as ready for review December 20, 2025 12:08
@rossaddison rossaddison merged commit 96fb76a into master Dec 20, 2025
23 of 29 checks passed
@rossaddison rossaddison deleted the alert-autofix-2 branch December 20, 2025 12:08
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