Reports workflows that use the pull_request_target trigger.
The rule reports an error when the workflow also uses high-risk patterns such as checking out code or running scripts with write permissions.
pull_request_target runs in the context of the base repository and can access privileged tokens or secrets depending on workflow configuration. It is useful for trusted automation, but risky when combined with untrusted pull request code.
name: Risky
on:
pull_request_target:
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm testUse pull_request for workflows that build, test, or execute pull request code:
on:
pull_request:
permissions:
contents: readIf pull_request_target is required, avoid checking out or executing untrusted pull request code and keep permissions minimal.
warningwhenpull_request_targetis presenterrorwhen a high-risk pattern is detected
Strict mode does not currently change this rule's severity because high-risk patterns are already reported as errors.
Some labeler or triage workflows safely use pull_request_target. Review the finding and keep the workflow narrowly scoped.