Potential fix for code scanning alert no. 6: Workflow does not contain permissions #265
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/yourtablecloth/TableCloth/security/code-scanning/6
In general, the fix is to define explicit GITHUB_TOKEN permissions at the workflow or job level, granting only the scopes needed. Since this workflow strictly reads repository contents (via
actions/checkout) and does local builds/tests, the minimal required permission iscontents: read. There is no indication that it needs to write to contents, issues, pull requests, or other resources.The single best fix, without changing functionality, is to add a root-level
permissions:block just under the workflowname:(or underon:), applying to all jobs that do not override it. This should specifycontents: read. No job-specific override seems necessary, as neithervalidate-versionnorbuildneeds write access. Concretely, in.github/workflows/build.yml, insert:between the existing
name: TableCloth Build Pipelineand theon:block. No other imports, methods, or definitions are needed.Suggested fixes powered by Copilot Autofix. Review carefully before merging.