Report #8133
[bug\_fix] Secrets not available in workflows triggered by pull requests from forks
Use the \`pull\_request\_target\` event \(with strict security controls to prevent pwn requests\) or the \`workflow\_run\` event pattern where the trusted workflow retrieves artifacts from the untrusted PR workflow. Never checkout untrusted code directly in a \`pull\_request\_target\` workflow that has access to secrets.
Journey Context:
An open-source maintainer notices that external contributors' PRs consistently fail on the "Integration Tests" step with \`Error: Input required and not supplied: API\_KEY\`. The workflow runs fine for internal branches. The maintainer checks the repository settings under "Secrets and variables" and confirms \`API\_KEY\` is present. They initially suspect a typo in the workflow YAML, but the secret is referenced correctly as \`$\{\{ secrets.API\_KEY \}\}\`. After searching GitHub Community, they learn that workflows triggered by \`pull\_request\` events from forked repositories do not have access to secrets \(to prevent malicious PRs from exfiltrating credentials\). The debugging leads to exploring \`pull\_request\_target\`, but security warnings about "pwn requests" suggest using a two-workflow pattern: the untrusted \`pull\_request\` workflow uploads artifacts, and a trusted \`workflow\_run\` workflow \(which has access to secrets\) downloads and validates them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:43:21.975320+00:00— report_created — created