Skip to content
Merged
Changes from all commits
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
30 changes: 25 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@
workflow_dispatch:
merge_group:

permissions:
contents: write
checks: write

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6.0.2
with:
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
with:
bundler-cache: false

- name: Install dependencies

Check failure

Code scanning / CodeQL

Cache Poisoning via execution of untrusted code High

Potential cache poisoning in the context of the default branch due to privilege checkout of untrusted code. (
pull_request_target
).
Comment on lines +19 to +24
run: bundle install

- name: Run RuboCop

Check failure

Code scanning / CodeQL

Cache Poisoning via execution of untrusted code High

Potential cache poisoning in the context of the default branch due to privilege checkout of untrusted code. (
pull_request_target
).
Comment on lines +24 to +27
run: |
bundle exec rubocop

autocorrect:

Check failure

Code scanning / CodeQL

Cache Poisoning via execution of untrusted code High

Potential cache poisoning in the context of the default branch due to privilege checkout of untrusted code. (
pull_request_target
).
Comment on lines +27 to +31
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6.0.2
with:
Expand All @@ -27,7 +48,6 @@
bundle exec rubocop -A

- name: Check for changes
id: changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
Expand Down
Loading