| 1 | pull_request_target that builds the pull request | A workflow added for labelling or commenting also checks out the contributor's code, and the job has secrets and a write token. | Keep this trigger to metadata-only jobs. Build untrusted code under pull_request, where secrets are absent. |
| 2 | Event context interpolated into run: | The YAML looks like a template, but the title or branch name is pasted into the shell command line. | Pass the value through env: and quote it in the script; never place the expression inside the command text. |
| 3 | A default write token | Any step, including a third-party action, can push commits, move tags or edit releases. | Set permissions: contents: read at the top and grant the one job that needs write its own scope. |
| 4 | An action pinned to a tag | The digest changes after an upstream release, and the next run executes code nobody reviewed. | Pin to a full commit SHA with the version in a comment, and let Dependabot open the update PR. |
| 5 | A self-hosted runner on a public repository | Untrusted jobs run inside your network with whatever the runner host can reach. | Use GitHub-hosted or ephemeral runners for public events; keep persistent runners for trusted, protected jobs only. |
| 6 | A deploy step that runs on forks | The step does not fail; the secret is simply empty, and the deploy reports success or silently skips. | Gate jobs on the event and the repository, and fail explicitly when a required secret is missing. |
| 7 | Artifacts trusted across workflows | A privileged workflow_run job downloads an artifact produced by an untrusted workflow and executes it. | Treat artifacts as untrusted input: validate, do not execute, and keep the privileged workflow free of contributor code. |