Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions - #74

Merged
Ben Carpenter (Ben-Carpenter) merged 1 commit into
mainfrom
alert-autofix-3
Nov 6, 2026
Merged

Ben Carpenter (Ben-Carpenter) merged 1 commit into
mainfrom
alert-autofix-3

Conversation

@Ben-Carpenter

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/microsoft/SDCM/security/code-scanning/3

Add an explicit permissions block to the workflow so GITHUB_TOKEN is minimally scoped.
Best fix here: define permissions at the workflow root (applies to all jobs unless overridden), with:

  • contents: read

This preserves current functionality (checkout + build) while documenting and enforcing least privilege.
Change location: .github/workflows/dotnet-pr-build-validation.yml, immediately after the on: trigger block and before jobs:.

No imports, methods, or dependencies are required.

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

…n permissions

Workflow does not contain permissions

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the change adding explicit read-only repository-content permissions to the .NET PR build-validation workflow.

No open issues 🎉

What changed in this PR

Adds explicit token permissions to the .NET PR build-validation workflow to address code-scanning alert #3.

Changes:

  • Sets workflow-level permissions to contents: read, limiting GITHUB_TOKEN access while supporting checkout and build operations.
File Description
.github/​workflows/​dotnet-pr-build-validation.yml Adds read-only repository-content permissions before the jobs block.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change restricting the build workflow’s GITHUB_TOKEN to read-only repository contents access.

No open issues 🎉

Review effort: Balanced

@Ben-Carpenter
Ben Carpenter (Ben-Carpenter) requested review from a team and removed request for a team November 5, 2026 00:51
@Ben-Carpenter
Ben Carpenter (Ben-Carpenter) merged commit 939279a into main Nov 6, 2026
7 checks passed
@Ben-Carpenter
Ben Carpenter (Ben-Carpenter) deleted the alert-autofix-3 branch November 11, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants