Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#119

Merged
HeyItsGilbert merged 1 commit intomainfrom
alert-autofix-1
Apr 3, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#119
HeyItsGilbert merged 1 commit intomainfrom
alert-autofix-1

Conversation

@HeyItsGilbert
Copy link
Copy Markdown
Member

Potential fix for https://github.com/psake/PowerShellBuild/security/code-scanning/1

In general, the fix is to explicitly define a permissions: block for the workflow or individual jobs, granting only the scopes actually needed. For most build/publish workflows that only need to read the repository contents, contents: read is an appropriate minimal default. If later steps need more permissions (e.g., to create releases or write issues), those can be added explicitly.

For this specific file, the simplest and safest fix without altering functionality is to add a workflow-level permissions: block with contents: read. This will apply to the publish job because it currently has no permissions of its own. Concretely, in .github/workflows/publish.yaml, insert:

permissions:
  contents: read

between the on: block and the jobs: block. No additional imports or dependencies are needed, and no other lines in the workflow need to change.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

@HeyItsGilbert HeyItsGilbert marked this pull request as ready for review April 3, 2026 18:08
@HeyItsGilbert HeyItsGilbert enabled auto-merge (squash) April 3, 2026 18:09
@HeyItsGilbert HeyItsGilbert disabled auto-merge April 3, 2026 18:12
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Gilbert Sanchez <me@gilbertsanchez.com>
@HeyItsGilbert HeyItsGilbert enabled auto-merge (squash) April 3, 2026 18:12
@HeyItsGilbert HeyItsGilbert disabled auto-merge April 3, 2026 18:12
@HeyItsGilbert HeyItsGilbert merged commit 1b16805 into main Apr 3, 2026
4 of 5 checks passed
@HeyItsGilbert HeyItsGilbert deleted the alert-autofix-1 branch April 3, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant