Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
steps:
- uses: actions/checkout@v6.0.2
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
ref: ${{ github.event.pull_request.head.sha || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}

Comment on lines 14 to 18
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Using pull_request_target while checking out github.event.pull_request.head.sha from head.repo.full_name means the job will execute untrusted fork code with the base repo’s GITHUB_TOKEN permissions (contents: write at the workflow level). This is a known security footgun: a malicious fork PR can run arbitrary code (e.g., via Bundler/RuboCop) and use the write-scoped token to modify the base repository. Consider splitting into two jobs/workflows: a fork-safe lint job (triggered by pull_request or with job-level permissions: contents: read and no pushing) and a same-repo auto-correct job (only when head.repo.full_name == github.repository) that has write permissions and does the commit/push.

This issue also appears in the following locations of the same file:

  • line 18
  • line 44

Copilot uses AI. Check for mistakes.
- name: Setup Ruby
uses: ruby/setup-ruby@v1.299.0
Expand All @@ -38,8 +39,9 @@
fi

- name: Commit and push changes
if: env.changes == 'true'
if: env.changes == 'true' && github.event.pull_request.head.repo.full_name == github.repository
run: |
git checkout -b ${{ github.event.pull_request.head.ref }}

Check failure

Code scanning / CodeQL

Code injection Critical

Potential code injection in
${ github.event.pull_request.head.ref }
, which may be controlled by an external user (
pull_request_target
).
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
git add .
git commit -m "chore: auto-corrected with RuboCop"
git push
git push origin ${{ github.event.pull_request.head.ref }}

Check failure

Code scanning / CodeQL

Code injection Critical

Potential code injection in
${ github.event.pull_request.head.ref }
, which may be controlled by an external user (
pull_request_target
).
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Loading