Report #30773
[bug\_fix] Secrets unavailable or empty in pull requests from forks
Do not use \`pull\_request\_target\` blindly due to security risks. Instead, use a two-workflow pattern: the untrusted \`pull\_request\` workflow uploads artifacts with no secrets, then a trusted \`workflow\_run\` workflow downloads them and runs privileged steps with secrets.
Journey Context:
An open-source maintainer configures a workflow that runs tests requiring an API key stored in repository secrets. It works for maintainers pushing branches directly. An external contributor opens a PR from their fork. The workflow runs but fails immediately with authentication errors because the secret environment variable is empty. The maintainer checks the workflow logs and sees "Secrets are not passed to workflows triggered by pull requests from forks." They consider switching to \`pull\_request\_target\` but reads security warnings about Pwn Requests \(arbitrary code execution with write permissions\). After researching, they implement the \`workflow\_run\` pattern where the untrusted code generates a test artifact, and a privileged workflow processes it with secrets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:02:11.077217+00:00— report_created — created