Potential fix for code scanning alert no. 5: Workflow does not contain permissions #81
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/smartcontractkit/chainlink-framework/security/code-scanning/5
In general, to fix this issue you explicitly define the
permissionsfor each workflow or job so theGITHUB_TOKENhas only the scopes required. For jobs that only run shell commands and check other jobs’ results, you can either setpermissions: {}to remove all default scopes, or set a very limited permission such ascontents: readif you want to be conservative and future‑proof minimal read operations.For this specific workflow, the
detect-modulesandgolangci-lintjobs already define explicit permissions. Only thegolangci-lint-resultjob is missing them. The best fix without changing existing functionality is to add apermissionsblock togolangci-lint-result. Since that job merely evaluatesneeds.golangci-lint.resultand exits with a status code, it does not actually need any GitHub API access; therefore,permissions: {}is sufficient and most restrictive. If you prefer to follow the pattern used elsewhere in the workflow, you can also usepermissions: contents: read, but the most minimal and clearly safe is an empty permissions map.Concretely, in
.github/workflows/golangci_lint.yml, add apermissionskey under thegolangci-lint-resultjob (around line 50) with an empty mapping. No imports or additional methods are needed, as this is only a YAML configuration change.Suggested fixes powered by Copilot Autofix. Review carefully before merging.