Skip to content

Potential fix for code scanning alert no. 194: Workflow does not contain permissions#270

Draft
mgtennant wants to merge 1 commit into
mainfrom
alert-autofix-194
Draft

Potential fix for code scanning alert no. 194: Workflow does not contain permissions#270
mgtennant wants to merge 1 commit into
mainfrom
alert-autofix-194

Conversation

@mgtennant

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/bcgov/nr-ticdi/security/code-scanning/194

To fix the problem, explicitly define permissions for the workflow or for the affected jobs so the GITHUB_TOKEN does not implicitly inherit broad repository defaults. The safest general approach is to add a restrictive permissions block at the workflow root (applies to all jobs) and then override/expand only where needed.

In this file, the only job that currently declares permissions is promote (packages: write). The vars, deploy-test, and deploy-prod jobs do not appear to need write access to repository contents or other scopes; they mostly call actions and a reusable workflow and use secrets. The single best minimal change is to add a root-level permissions block near the top of the file (after name: and before on:) that sets all scopes to read-only by default. Jobs that require broader permissions (like promote) will continue to override this with their own permissions block, which already exists. No imports or additional methods are needed; this is a pure YAML configuration change in .github/workflows/merge.yml.

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

…ain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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