Skip to content

Conversation

@chgeo
Copy link
Contributor

@chgeo chgeo commented Aug 20, 2025

Potential fix for https://github.com/capire/samples/security/code-scanning/4

To fix the problem, we should add a permissions block to the workflow. Since the workflow only checks out code and runs tests, it only needs read access to repository contents. The best way to fix this is to add permissions: contents: read at the root level of the workflow (before the jobs: key), which will apply to all jobs in the workflow unless overridden. This change should be made in .github/workflows/test.yaml, above the jobs: key.

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

chgeo and others added 4 commits August 20, 2025 16:11
…n permissions

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@chgeo chgeo marked this pull request as ready for review August 20, 2025 14:16
@chgeo
Copy link
Contributor Author

chgeo commented Aug 20, 2025

@swaldmann these changes should be part of our GH actions template, right?
Otherwise GH security checks will complain (see above).

@chgeo chgeo requested a review from swaldmann August 20, 2025 14:17
@chgeo chgeo changed the title Potential fix for code scanning alert no. 4: Workflow does not contain permissions fix: code scanning alert: Workflow does not contain permissions Aug 20, 2025
@swaldmann
Copy link
Contributor

Yes, should add them there.

@swaldmann swaldmann merged commit c3862d1 into main Aug 25, 2025
6 checks passed
@swaldmann swaldmann deleted the alert-autofix-4 branch August 25, 2025 18:42
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.

3 participants