Skip to content

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

Merged
erseco merged 1 commit intomainfrom
alert-autofix-2
Aug 4, 2025
Merged

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

Conversation

@erseco
Copy link
Owner

@erseco erseco commented Aug 4, 2025

Potential fix for https://github.com/erseco/python-moodle/security/code-scanning/2

To fix the problem, you should add a permissions block to the workflow, either at the root level (to apply to all jobs) or at the job level (to apply to specific jobs). Since the workflow only reads repository contents and does not need to write to issues, pull requests, or other resources, the minimal required permission is contents: read. This should be added at the root level, just below the name field and before the on field, to ensure all jobs inherit this least-privilege setting unless overridden.

No additional methods, imports, or definitions are needed—just a YAML block addition.


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>
@erseco erseco marked this pull request as ready for review August 4, 2025 21:26
@erseco erseco merged commit bdea069 into main Aug 4, 2025
7 checks passed
@erseco erseco deleted the alert-autofix-2 branch August 4, 2025 21:26
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