Skip to content

pull_request_target workflow checks out untrusted code

Gaphigh severity · reads .yml .yamlBeta

pull_request_target runs with your repository's secrets; checking out the contributor's code lets a pull request run with them (CWE-829). When Lintsure finds this, it marks it as a Gap: the code itself shows the problem.

What it looks like

A line Lintsure flags in its own test app:

// .github/workflows/ci.yml
ref: ${{ github.event.pull_request.head.sha }}

How to fix it

Use the pull_request trigger for workflows that build or run code from a pull request. If you need pull_request_target, never check out the pull request's code in it.

Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.

Controls it relates to

What the framework asks

OWASP Top 10 A03:2025: Software Supply Chain Failures

The code you didn't write: dependencies, build tools and CI. Versions should be pinned, install scripts shouldn't fetch code, CI actions should be pinned, untrusted pull requests must not run with your secrets, and text from issues or pull requests must never become part of a CI command.

Evidence a reviewer may ask for: Lockfiles, CI workflow files and the dependency update process.

OWASP Top 10 A08:2025: Software or Data Integrity Failures

Don't trust code or data you haven't checked: no unsafe deserialisation, integrity checks on third-party scripts, and no trust in values users can change.

Evidence a reviewer may ask for: How third-party scripts are loaded and how incoming data is parsed.

Cyber Resilience Act Annex I Part II (7): Updates distributed securely

Builds and updates can't be swapped or tampered with: pinned CI steps, workflow tokens limited to what they need, untrusted pull requests and issue text kept away from secrets and commands, and nothing run straight from a download without a check.

Evidence a reviewer may ask for: Release signing, CI configuration and how users receive updates.

Summaries are our own reading of the public texts, not the official wording.

Read more: GitHub Actions script injection

Check your code for this

Runs on your machine. Your code is never uploaded.

npx lintsure scan

Quickstart · Use it in Claude Code or Cursor

This rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer

We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.

Related rules

Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.