Skip to content

fix: split preview deploy to prevent secret exposure from fork PRs - #5309

Open
jackmisbach wants to merge 2 commits into
swaponline:masterfrom
jackmisbach:master
Open

fix: split preview deploy to prevent secret exposure from fork PRs#5309
jackmisbach wants to merge 2 commits into
swaponline:masterfrom
jackmisbach:master

Conversation

@jackmisbach

Copy link
Copy Markdown

Checklist

  • I have read the CONTRIBUTING guide
  • Good naming (as clear and simple as possible)
  • I checked the PR once again

The current pr-preview.yml uses pull_request_target and checks out the fork PR code in the same job that has access to Cloudflare deployment credentials. While the credentials are scoped to the deploy step, running untrusted code in the same job as secrets is a known anti-pattern, and it is possible to get the Cloudflare apiToken and accountId here. Although I'm sure the API token is scoped down to the PR preview pages and doesn't have access to anything else, regardless, or so I'd presume?

However, this PR splits the workflow into two for security purposes:

  • pr-preview-build.yml: triggers on pull_request (which has no secrets for forks), builds the project, uploads the artifact
  • pr-preview-deploy.yml: triggers on workflow_run after the build completes, downloads the artifact, and deploys to Cloudflare Pages

reference: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/

@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown

Preview Deploy

URL https://ebd72189.mcw-preview.pages.dev
Commit 35837a0
Status ✅ Ready

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