Skip to content

Commit 9f100a7

Browse files
fix(VUL-29426): restrict PHPCBF job to same-repo pull requests
Addresses CodeQL finding actions/untrusted-checkout/medium (CWE-829) in .github/workflows/lint.yml. The phpcbf job checks out the PR head ref and has contents:write and pull-requests:write permissions. On a pull_request trigger, fork PRs can reach this job with a crafted branch that runs composer scripts in a writable context. Add a same-repo guard so the job only runs for internal branch PRs, matching the pattern already used in pantheon-systems/.github's pr-label.yml reusable workflow.
1 parent 5a6b94c commit 9f100a7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ jobs:
77
phpcbf:
88
name: PHPCBF & Commit
99
runs-on: ubuntu-latest
10+
# Skip fork PRs: this job checks out the PR head ref and has write
11+
# permissions (contents, pull-requests). Running fork-controlled code
12+
# (e.g. via composer scripts) in that context is an untrusted-checkout
13+
# risk (CWE-829), even though GitHub already read-only-limits the token
14+
# for fork PRs. Internal branch PRs (same repo) match here.
15+
if: github.event.pull_request.head.repo.full_name == github.repository
1016
steps:
1117
- name: Checkout
1218
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

0 commit comments

Comments
 (0)