Skip to content

Conversation

@tobitege
Copy link
Owner

Potential fix for https://github.com/tobitege/OpenSourceToolkit.NET/security/code-scanning/1

To fix the problem, explicitly declare the permissions for the GITHUB_TOKEN so that the workflow does not rely on potentially over‑permissive repository defaults. Since this CI workflow only needs to read the repository contents to build, the minimal safe permission is contents: read.

The best way to fix this without changing functionality is to add a permissions block at the workflow level (top-level, alongside name and on). This will apply to all jobs in the workflow that do not override it. Concretely, in .github/workflows/ci.yml, insert:

permissions:
  contents: read

between the name: CI Build line and the on: block. No other changes, imports, or definitions are needed; GitHub Actions natively supports the permissions key, and the existing steps (checkout, setup-dotnet, build) will continue to function correctly with read-only repository access.

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>
@tobitege tobitege marked this pull request as ready for review December 20, 2025 04:27
@tobitege tobitege merged commit 83ba0ee into main Dec 20, 2025
5 checks passed
@tobitege tobitege deleted the alert-autofix-1 branch December 20, 2025 04:27
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.

2 participants