chore: add explicit permission on release workflow #4999
Merged
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/scaleway/scaleway-cli/security/code-scanning/51
The best way to fix this problem is to add an explicit
permissionsblock to the workflow. Ideally, you should set this block at the top (workflow) level so that it applies to all jobs, unless a particular job requires more specific permissions—in which case, override at the job level. As a minimal and safe default, usecontents: read. If a job (such asgoreleaser, which may need to create GitHub Releases or upload assets) requires additional permissions (such ascontents: writeorpackages: write), configure these specifically for that job. Since thewasmjob seems only to publish to npm and not interact with the GitHub API, it can probably use onlycontents: read, butgoreleasermay require more.For the minimal fix, add
permissions: contents: readat the root workflow level. For greater robustness, consider specifying job-level permissions:goreleaserwithcontents: write,wasmwithcontents: read.Files/regions to change:
permissions:block after thename:at the top of.github/workflows/release.yml.permissions:block under thegoreleaser:job if it requires it, otherwise rely on the root-level block.Suggested fixes powered by Copilot Autofix. Review carefully before merging.