Skip to content

Potential fix for code scanning alert no. 5: Workflow does not contain permissions#23

Merged
Malcolmnixon merged 1 commit intomainfrom
alert-autofix-5
Dec 25, 2025
Merged

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

Conversation

@Malcolmnixon
Copy link
Contributor

Potential fix for https://github.com/demaconsulting/DotnetToolWrapper/security/code-scanning/5

In general, to fix this type of issue you add an explicit permissions block at the workflow root or per job to limit GITHUB_TOKEN to the minimum required scopes. Jobs that call reusable workflows (uses: ./.github/workflows/...) can and should still declare permissions, which become the upper bound for what the reusable workflow can do.

For this specific file, the best minimal change is to add a permissions section under the build job, similar to quality-checks, granting read‑only access to repository contents. This preserves existing behavior for read operations while removing any unnecessary write permissions that might otherwise be inherited from repo defaults. Concretely, in .github/workflows/build_on_push.yaml, under build: and aligned with name, needs, and uses, insert:

    permissions:
      contents: read

No extra imports or methods are required; this is purely a YAML configuration change.

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

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Malcolmnixon Malcolmnixon marked this pull request as ready for review December 25, 2025 02:17
@Malcolmnixon Malcolmnixon merged commit 4964fe4 into main Dec 25, 2025
8 checks passed
@Malcolmnixon Malcolmnixon deleted the alert-autofix-5 branch December 25, 2025 02:19
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