Report #68235
[bug\_fix] Secrets appear empty or authentication fails in workflows triggered by pull requests from forks
For workflows requiring secrets on fork PRs, use the \`pull\_request\_target\` event with explicit checkout of the merge commit SHA and path filtering, or use a two-workflow pattern: an untrusted \`pull\_request\` workflow uploads artifacts, and a trusted \`workflow\_run\` workflow downloads them and runs with secrets.
Journey Context:
You maintain an open-source project. A contributor forks your repo and opens a PR to add a feature. Your CI workflow runs to test the changes, but it fails immediately with 'Error: Input required and not supplied: api-key' or the API client returns 401. You check the workflow logs and see the secret is being passed as empty. You verify the secret exists in the base repository settings. You realize that for security, GitHub does not pass secrets to workflows triggered by \`pull\_request\` events from forks, to prevent malicious exfiltration. You consider switching to \`pull\_request\_target\` but read security warnings about 'pwn requests'. You implement a safe \`pull\_request\_target\` workflow that only checks out the PR code after verifying the merge commit SHA, or you split it into two workflows: one that uploads the build artifact on \`pull\_request\`, and a second on \`workflow\_run\` that downloads it and runs tests with secrets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:01:04.880790+00:00— report_created — created