Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

Potential fix for code scanning alert no. 1: Workflow does not contain permissions - #26

Merged
adrianmejias merged 1 commit into
mainfrom
alert-autofix-1
Mar 1, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#26
adrianmejias merged 1 commit into
mainfrom
alert-autofix-1

Conversation

@adrianmejias

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/versaorigin/cloudflare-turnstile/security/code-scanning/1

In general, the fix is to explicitly scope the GITHUB_TOKEN permissions for this workflow to the least required. Since this workflow only checks out code, installs dependencies, and runs PHPStan, it only needs read access to repository contents. The best fix is to add a top-level permissions block (applies to all jobs) setting contents: read.

Concretely, in .github/workflows/phpstan.yml, insert a permissions: section after the name: PHPStan line and before the on: block:

  • permissions:
    • contents: read

No other changes are necessary; none of the steps require write permissions to GitHub resources.

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>
Signed-off-by: Adrian Mejias <1440288+adrianmejias@users.noreply.github.com>
@adrianmejias adrianmejias self-assigned this Mar 1, 2026
@adrianmejias
adrianmejias marked this pull request as ready for review March 1, 2026 00:14
Copilot AI review requested due to automatic review settings March 1, 2026 00:14
@adrianmejias
adrianmejias merged commit 3e6b172 into main Mar 1, 2026
3 of 4 checks passed
@adrianmejias
adrianmejias deleted the alert-autofix-1 branch March 1, 2026 00:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses GitHub code scanning alert #1 by explicitly scoping GITHUB_TOKEN permissions in the PHPStan workflow to least privilege, limiting the workflow to read-only access to repository contents.

Changes:

  • Added a top-level permissions block to .github/workflows/phpstan.yml
  • Set contents: read to restrict default token permissions for the workflow

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants