Skip to content

Potential fix for code scanning alert no. 15: Workflow does not contain permissions#312

Open
radhe wants to merge 1 commit into
developfrom
alert-autofix-15
Open

Potential fix for code scanning alert no. 15: Workflow does not contain permissions#312
radhe wants to merge 1 commit into
developfrom
alert-autofix-15

Conversation

@radhe

@radhe radhe commented Jan 23, 2026

Copy link
Copy Markdown
Member

Potential fix for https://github.com/rtCamp/login-with-google/security/code-scanning/15

In general, the problem is fixed by explicitly specifying permissions: for the workflow or for the specific job, instead of relying on the repository/organization default GITHUB_TOKEN permissions. This enforces the principle of least privilege and satisfies CodeQL’s requirement that permissions be explicitly limited.

For this workflow, the best fix without changing existing functionality is to add a permissions: block at the job level for runPHPCSInspection. Since the job runs a code review action that may need to interact with pull requests, we can conservatively grant contents: read (to read the code) and pull-requests: write (to allow the action to comment/review on the PR if it uses GITHUB_TOKEN). If the action in reality does not need write access, pull-requests: write could later be removed, but adding it now minimizes the risk of breaking existing behavior. The change should be inserted under the job definition (after runs-on: ubuntu-latest or before, both are valid YAML) in .github/workflows/phpcs_on_pull_request.yml. No imports or additional files are needed, since this is purely a workflow YAML configuration change.

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>
@radhe radhe marked this pull request as ready for review January 23, 2026 12:19
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