Potential fix for code scanning alert no. 3: Workflow does not contain permissions #107
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.
Potential fix for https://github.com/gepa-ai/gepa/security/code-scanning/3
The recommended fix is to explicitly specify a
permissions
block in the workflow YAML file to limit the GITHUB_TOKEN permissions according to the principle of least privilege. The minimal safe default for most workflows is likelypermissions: { contents: read }
, which grants read-only access to repository contents. This can be set either at the workflow root (to apply to all jobs) or per job; since CodeQL flags thebuild_package
job, either approach would resolve the error, but setting at the workflow root ensures all jobs are protected and avoids having to duplicate the block.permissions:
block at the top level of.github/workflows/run_tests.yml
(just aftername:
or directly belowon:
).permissions: { contents: read }
after thename:
in the workflow root, so all jobs that do not need write access will operate under read-only permissions.permissions:
block after thename:
(line 1), before theon:
block (line 3), to apply universally.Suggested fixes powered by Copilot Autofix. Review carefully before merging.