Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#28

Merged
frag223 merged 1 commit intomainfrom
alert-autofix-1
Aug 19, 2025
Merged

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

Conversation

@frag223
Copy link
Copy Markdown
Contributor

@frag223 frag223 commented Aug 19, 2025

Potential fix for https://github.com/code-gorilla-au/pyrotic/security/code-scanning/1

To fix the problem, we should add a permissions block to the workflow. Since the job only checks out code, installs tools, and runs tests/lint/scan, it does not require write access to repository contents or other resources. The minimal required permission is contents: read. This can be set either at the workflow level (applies to all jobs) or at the job level (applies only to the specific job). The best practice is to set it at the workflow level unless a job requires different permissions. Therefore, add the following block after the name: field and before the on: field in .github/workflows/pull-request.yaml:

permissions:
  contents: read

No additional imports, methods, or definitions are needed.

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>
@frag223 frag223 marked this pull request as ready for review August 19, 2025 21:44
@frag223 frag223 merged commit d676d8d into main Aug 19, 2025
4 checks passed
@frag223 frag223 deleted the alert-autofix-1 branch August 19, 2025 21:48
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