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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 months ago
In general, the problem is fixed by explicitly adding a
permissionsblock to the workflow or to the specific job so that the GITHUB_TOKEN has only the minimum required access. Since this workflow only defines a single job that calls a reusable workflow, and we don’t know any need for write access from this file, we can safely restrict permissions to read-only for repository contents.The best minimal change is to add a
permissionsblock at the workflow (top) level, just undername: Secrets Scan. This will apply to all jobs in this workflow (includingscan) unless they override permissions themselves. A conservative least-privilege choice iscontents: read, which allows the reusable workflow to read repository contents while preventing write operations with the GITHUB_TOKEN from this workflow’s context.Concretely, in
.github/workflows/secrets-scan-on-pr.yaml, insert:between line 1 (
name: Secrets Scan) and line 3 (on:). No additional imports, methods, or definitions are needed because this is purely a YAML configuration change.