Skip to content

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

Merged
inimaz merged 2 commits into
masterfrom
alert-autofix-20
Jul 12, 2025
Merged

Potential fix for code scanning alert no. 20: Workflow does not contain permissions#898
inimaz merged 2 commits into
masterfrom
alert-autofix-20

Conversation

@SaboniAmine

Copy link
Copy Markdown
Member

Potential fix for https://github.com/mlco2/codecarbon/security/code-scanning/20

To resolve the issue, we need to add a permissions block to the workflow file. This block should explicitly define the least privileges required for the workflow tasks. Since the workflow primarily involves installing dependencies, running tests, and setting up a database, it likely only requires read access to repository contents. Write permissions are not visibly required for the tasks in this workflow.

The permissions block can be added at the root level of the workflow, applying to all jobs, or to each job individually. For simplicity and consistency, we will add this block at the root level of the workflow.


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

SaboniAmine and others added 2 commits July 12, 2025 16:36
…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@inimaz inimaz marked this pull request as ready for review July 12, 2025 14:56
@inimaz inimaz self-requested a review July 12, 2025 14:56
@inimaz inimaz merged commit 64a65d0 into master Jul 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants