Conversation
.github/workflows/createrelease.yml
Outdated
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix this problem, you should add an explicit permissions: block either at the workflow root (recommended, since all jobs do not need to elevate permissions beyond artifact download/upload and release code deployment) or within each job if different jobs require different levels. For this workflow, adding to the root will suffice and makes the minimal necessary permissions clear to all jobs. For most build and deployment pipelines, contents: read should be sufficient. Artifact upload/download and NuGet publishing do not need write access to repo contents or administration unless you use actions that interact with pull requests, issues, or workflow runs (which you do not). If in future you add steps that require further permission, you can granularly elevate privileges for those jobs only.
Implementation steps:
- Insert a
permissions:block at the root (after or beforeon:), specifying least-privilege settings—generallycontents: readis the safest default. - Ensure not to grant more than necessary: do not include
contents: writeunless you actually push changes to the repository, which you do not. - No additional imports or definitions are required for YAML workflows.
| @@ -1,5 +1,8 @@ | ||
| name: Release | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] |
closes #505
closes #507
closes #511