Skip to content

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

Merged
dedece35 merged 1 commit intomainfrom
alert-autofix-5
Feb 13, 2026
Merged

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

Conversation

@dedece35
Copy link
Copy Markdown
Member

Potential fix for https://github.com/green-code-initiative/creedengo-python/security/code-scanning/5

In general, the fix is to add an explicit permissions section specifying the minimal scopes required for the workflow. You can add this either at the root (applies to all jobs) or per job. Here, only the build and upload jobs use GITHUB_TOKEN for release operations, which require contents: write; the checks job only inspects permissions and does not need write access. The cleanest least‑privilege fix is: set restrictive default permissions at the workflow root (e.g., contents: read) and then override them with contents: write only for the jobs that create and upload release assets.

Concretely:

  • At the top level of .github/workflows/tag_release.yml, add a permissions: block after name: Tag Release (or after on:) setting contents: read.
  • In the build job, add a permissions: block with contents: write because actions/create-release@v1 needs to create a release (which writes to repository contents/releases).
  • In the upload job, add a permissions: block with contents: write because actions/upload-release-asset@v1 needs to upload assets to an existing release.
  • Leave the checks job with default (inherited) contents: read, which is sufficient since it doesn’t use GITHUB_TOKEN explicitly.

No new imports, methods, or external dependencies are required; this is purely a workflow-permissions configuration change in .github/workflows/tag_release.yml.

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>
@dedece35 dedece35 marked this pull request as ready for review February 13, 2026 20:41
@dedece35 dedece35 merged commit ea90403 into main Feb 13, 2026
9 checks passed
@dedece35 dedece35 deleted the alert-autofix-5 branch February 13, 2026 20:41
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

- '[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: read

Check notice

Code scanning / SonarCloud

Read permissions should be defined at the job level Low

Move this read permission from workflow level to job level. See more on SonarQube Cloud
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