Skip to content

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

Draft
teolemon wants to merge 1 commit intomainfrom
alert-autofix-11
Draft

fix: Potential fix for code scanning alert no. 11: Workflow does not contain permissions#190
teolemon wants to merge 1 commit intomainfrom
alert-autofix-11

Conversation

@teolemon
Copy link
Copy Markdown
Member

Potential fix for https://github.com/openfoodfacts/facets-knowledge-panels/security/code-scanning/11

General fix:
Explicitly specify a minimal permissions: block, either at the workflow level (applies to all jobs) or at the job level. According to best practices, you should grant only the permissions absolutely required by the steps in the workflow. Since this workflow mainly adds issues and PRs to GitHub Projects, which typically requires interacting with issues or PRs, but authentication is provided via a PAT, we can safely restrict the GITHUB_TOKEN to read-only permissions on repository contents.

Detailed fix:
Add the following block at the very top level of the workflow, just after the name: and before on::

permissions:
  contents: read

This restricts the GITHUB_TOKEN to read-only access to repository contents for the entire workflow, following least-privilege principles. If in the future a step requiring additional permissions is added, this can be revisited.

Which files/lines to change:
Edit .github/workflows/github-projects.yml. Insert the permissions: block (as above) after line 1, before line 3.

Methods/imports/definitions needed:
No imports/definitions are needed for a workflow permissions block.


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

…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@teolemon teolemon changed the title Potential fix for code scanning alert no. 11: Workflow does not contain permissions fix: Potential fix for code scanning alert no. 11: Workflow does not contain permissions Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

1 participant