Skip to content

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

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

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

Conversation

@SaboniAmine

Copy link
Copy Markdown
Member

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

To resolve the issue, we need to add explicit permissions blocks to limit the GITHUB_TOKEN privileges to the minimum required. This can be done at the job level by specifying the permissions key for the test_api_server job. If the job does not require write access, we should set contents: read as the minimal permissions.

In this case:

  1. Add a permissions block to the test_api_server job with contents: read to restrict the GITHUB_TOKEN to read-only access to repository contents.
  2. Ensure that no unintended permissions are granted.

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 15:10

@inimaz inimaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@inimaz inimaz merged commit 984586e into master Jul 12, 2025
5 checks passed
@inimaz inimaz deleted the alert-autofix-17 branch July 12, 2025 15:11
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