Skip to content

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

Merged
qdequippe merged 1 commit intomainfrom
alert-autofix-3
Jan 2, 2026
Merged

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

Conversation

@qdequippe
Copy link
Member

Potential fix for https://github.com/qdequippe-tech/yousign-php-api/security/code-scanning/3

In general, to fix this problem you should explicitly declare a permissions block for the workflow and/or each job so that the GITHUB_TOKEN has only the privileges required to run. For read-only CI tasks that just check out the code and run analysis, contents: read is typically sufficient.

For this specific workflow, the check-cs job only checks out the repository and runs PHP-CS-Fixer in dry-run mode, so it does not need any write permissions. The simplest and least-intrusive fix is to add a workflow-level permissions block (applies to all jobs) near the top of .github/workflows/ci.yml, right after the name: CI line. Set contents: read as the minimal starting point recommended by CodeQL. No imports or additional methods are needed since this is just a YAML configuration change.

Concretely:

  • Edit .github/workflows/ci.yml.
  • Insert a permissions: section after line 1 (name: CI) with contents: read.
  • Leave the rest of the workflow unchanged so functionality remains identical, but with a restricted GITHUB_TOKEN.

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>
@qdequippe qdequippe marked this pull request as ready for review January 2, 2026 12:20
@qdequippe qdequippe merged commit 1bce206 into main Jan 2, 2026
3 checks passed
@qdequippe qdequippe deleted the alert-autofix-3 branch January 2, 2026 12:22
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