Skip to content

Commit 957d403

Browse files
authored
ci: avoid direct use of untrusted PR metadata (#14232)
1 parent 214c44b commit 957d403

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,13 @@ jobs:
6666
6767
- name: Save PR metadata
6868
if: github.event_name == 'pull_request'
69+
env:
70+
PR_NUMBER: ${{ github.event.pull_request.number }}
71+
HEAD_REF: ${{ github.head_ref }}
6972
run: |
7073
mkdir -p pr-metadata
71-
echo "${{ github.event.pull_request.number }}" > pr-metadata/pr_number
72-
BRANCH="${{ github.head_ref }}"
74+
echo "$PR_NUMBER" > pr-metadata/pr_number
75+
BRANCH="$HEAD_REF"
7376
# Sanitize branch name into a valid Wrangler preview alias.
7477
# Wrangler validates aliases against /^[a-z](?:[a-z0-9-]*[a-z0-9])?$/i so the
7578
# alias must start with a letter, contain only [a-z0-9-], and end with a letter

0 commit comments

Comments
 (0)