Imagine a workflow that runs a popular marketplace action by its version tag, something like some-org/some-action@v3. One night the maintainer's account is compromised. The attacker moves the v3 tag to a new commit that reads the job's secrets and sends them to a server they control. Nothing in your repository changes. The next push triggers the workflow, the step runs, and it finishes green.
That is roughly what happened to several widely used actions in 2025 and 2026. The uncomfortable part is that the workflow did exactly what it was told: run whatever v3 points to.
A third-party action is code running inside your job, with your token, your secrets, and your runner. Treat it like a dependency that has production access. In practice that means four things:
- Lock exactly what runs, so a moved tag can't change your pipeline behind your back.
- Shrink what it can reach, so a bad action finds as little as possible.
- Control what can run at all, with allow lists and safer triggers.
- Have a plan for when one is compromised, because pinning lowers the risk but doesn't remove it.
The examples below use GitHub Actions first, then cover the same risks in Azure DevOps. Product behavior and dates are as of November 2026; GitHub in particular changed several defaults this year, so check the linked pages before you rely on a specific setting.
What an action can reach inside your job
GitHub's secure use reference is blunt about the risk: a compromised action "would have access to all secrets configured on your repository" and "may be able to use the GITHUB_TOKEN to write to the repository."
It helps to list everything a step can touch, because that list is also your rotation list if something goes wrong:
- Secrets passed to the job. Any secret the workflow references is available to code in that job. An action doesn't need you to pass it a secret as an input to find it.
- The GITHUB_TOKEN. Its permissions depend on your repository settings and the
permissions:block. With write access, a malicious step can push commits or change releases. - Cloud credentials the job can request. If the job has
id-token: write, any step can request an OIDC token and exchange it for short-lived cloud access, within whatever the federated identity is allowed to do. - The checked-out code and the runner's filesystem. That includes build outputs, caches, and any credentials earlier steps wrote to disk.
- On self-hosted runners, the machine and its network. GitHub warns that self-hosted runners "can be persistently compromised by untrusted code in a workflow," and they often sit inside networks that hosted runners can't reach.
A step doesn't need permission to see what the job can see. That's why the controls later in this article focus as much on what the job can reach as on which action you pick.
This has already happened: tags moved to malicious code
Two incidents show the pattern clearly.
tj-actions/changed-files and reviewdog (March 2025). CISA's alert describes how tj-actions/changed-files (CVE-2025-30066) was compromised, and notes that this "was potentially enabled by a compromise of another GitHub Action, reviewdog/action-setup@v1" (CVE-2025-30154). CISA gives the exposure windows as 2025-03-12 00:00 UTC to 2025-03-15 12:00 UTC for tj-actions, and March 11, 2025, between 18:42 and 20:31 UTC for reviewdog. The GitHub advisory says existing version tags were repointed to a malicious commit whose payload printed CI/CD secrets into workflow logs, encoded in base64. On a public repository, those logs were readable by anyone. CISA advised readers to "Rotate all identified secrets immediately", and both CVEs were added to its Known Exploited Vulnerabilities catalog.
The reviewdog part matters for a different reason. CISA lists several other reviewdog actions that may have been affected because they used action-setup internally. You could have pinned the action you called and still run the compromised one underneath it.
Trivy (March 2026). The GitHub advisory for CVE-2026-33634 says that on March 19, 2026, an attacker used compromised credentials to publish a malicious Trivy release and force-pushed 76 of 77 trivy-action tags and all 7 setup-trivy tags to malicious commits. The malicious code ran before the real scan, so affected workflows looked normal. The advisory also describes this as a continuation of an earlier compromise, after which credential rotation hadn't been atomic. Aqua, Trivy's maintainer, wrote in its incident post that "the rotation was not fully comprehensive."
Aqua's post adds a detail worth remembering: the poisoned tags also showed "Immutable" badges, and "Organizations should not rely solely on the 'Immutable' indicator." Aqua's own recommendation is that "Pinning to full commit SHAs remains the only truly immutable protection."
The lesson from both incidents is the same. A version tag is a pointer that someone else controls. If their account or their release process is compromised, your next run executes whatever the tag points to.
Lock exactly what runs: SHA pins and the new lockfiles
Pin each third-party action to a full-length commit SHA. A commit SHA identifies one exact tree of code. GitHub's guidance is still to "Pin references to actions to a commit SHA in your workflow files," and notes that a tag "can be moved or deleted if a bad actor gains access to the repository storing the action." Keep the version as a comment on the same line, for example uses: some-org/some-action@<40-character SHA> # v3.2.1, so people (and Dependabot) can still read which release it is.
Two cautions come with pinning:
- Check where the SHA comes from. GitHub says that when selecting a SHA, "you should verify it is from the action's repository and not a repository fork." Scanners such as zizmor have an
impostor-commitaudit that checks for this. - A pin locks in what you pinned, good or bad. If you pin a commit that is already malicious, you've locked in the malicious code. GitHub's advice is "Regardless of your measures, always audit the source code of the action." At minimum, look at what changed when you move a pin.
Pinning also has blind spots, which is the main reason it's necessary but not sufficient:
- Actions inside actions. A composite action or reusable workflow can call other actions by tag. Your pin fixes the outer code, but if that code references
another-org/helper@v1, a movedv1still changes what runs. The reviewdog case is a real example. - Container images. An action can run a Docker image referenced by a tag such as
latest. A commit pin doesn't freeze the image. If you reference images directly, pin them by digest (@sha256:...).
Workflow lockfiles address the transitive problem. GitHub made workflow lockfiles generally available on 2026-10-28. A lockfile at .github/workflows/actions.lock, generated with the gh actions-lock CLI extension, records the exact commit for every action your workflows depend on, including transitive ones. The changelog says lockfiles let you keep readable tag references in your workflow files, there's a "Require lockfile" policy, and Dependabot can regenerate lock entries. GitHub's secure use page now calls lockfiles "the strongest protection available" and says they supersede SHA pinning for repositories that adopt them.
Two limits apply. GitHub says lockfiles "don't determine whether a dependency is safe," so you still need to review what you lock. And the announcement doesn't say whether lockfiles cover container images, so keep pinning images by digest until GitHub documents otherwise. Lockfiles are new, so check the current docs for plan availability before you standardize on them.
Enforce it, don't just recommend it. Since August 2025, organization and repository policies can require actions to be pinned to a full-length commit SHA, and "any workflow that attempts to use an action that isn't pinned will fail." Repository settings note that reusable workflows can still be referenced by tag under this policy, so review those separately or use the lockfile policy.
Keep pins current without losing vulnerability alerts
Pins go stale, and stale pins miss security fixes. Dependabot version updates can keep them current: add a dependabot.yml entry with package-ecosystem: "github-actions" and directory: "/", and Dependabot opens pull requests that bump the SHA. GitHub says it also updates the version comment "when the comment is on the same line."
There is a trade-off that's easy to miss. According to GitHub's secure use page, "Dependabot only creates alerts for vulnerable actions that use semantic versioning" and "will not create alerts for actions pinned to SHA values." In other words, as of November 2026, SHA-pinned actions don't get Dependabot vulnerability alerts. Dependabot also doesn't update container actions referenced with docker://.
Pinning is still the right call, but you need something else to tell you when a pinned action has a known problem:
- A workflow scanner. zizmor has a
known-vulnerable-actionsaudit, plus checks for impostor commits and SHA pins whose version comment doesn't match. OpenSSF Scorecard checks pinned dependencies, token permissions, and dangerous workflow patterns. - Reviewing pin bumps like code changes. A Dependabot pull request that moves a pin is a change to code that runs with your secrets. Read the release notes and the diff for actions that touch credentials, and don't auto-merge them by default.
- Watching advisories for the actions you depend on, especially security-sensitive ones like scanners, release tools, and anything that handles tokens.
Shrink what an action can reach
Pinning controls which code runs. The next layer limits what that code finds when it runs.
Set token permissions explicitly. Add a permissions: block at workflow or job level and grant only what each job needs, for example contents: read for a build job. GitHub changed the default GITHUB_TOKEN to read-only in February 2023, but that change "will not impact any existing enterprises, organizations or repositories." If your repository or organization existed before February 2023, check its workflow permissions setting, because it may still default to read and write.
Give secrets to as few jobs as possible. Reference a secret only in the job that needs it, and split jobs so that a lint or test job running third-party actions never sees deployment credentials. For sensitive secrets, use environments with required reviewers: GitHub says "A workflow job cannot access environment secrets until approval is granted by a reviewer."
Use short-lived cloud credentials instead of stored keys. For Azure, Microsoft's OIDC guide for GitHub Actions uses federated credentials instead of a client secret. The job needs id-token: write, so grant it only on the job that signs in to Azure. Federation doesn't stop a malicious step in that job from requesting a token, so keep the identity's role assignments narrow as well.
Keep untrusted input out of scripts. Text such as a pull request title or issue body can contain shell commands. GitHub's script injection guidance explains that expressions inside ${{ }} are substituted into the script before it runs. Instead of writing ${{ github.event.pull_request.title }} directly in a run: step, set it as an environment variable in env: and reference that variable in the script.
Be careful with self-hosted runners. Prefer ephemeral runners that are rebuilt after each job, keep them out of networks they don't need, and avoid using them for public repositories where outside contributors can trigger workflows.
Control what can run at all
Use an allow list. Organization and repository settings can restrict workflows to actions from GitHub, verified creators, or a specific list such as my-org/* plus named third-party actions. Since the August 2025 change, you can also block a specific action or version by prefixing an entry with !, and GitHub says the block list "is evaluated last, overriding any other policy that would otherwise allow the action." That gives you a fast way to stop an action across an organization during an incident.
Treat pull_request_target with care, and know that its defaults are changing. This trigger runs in the context of the base repository, with its secrets and a token that can have write access, even for pull requests from forks. GitHub's docs say "Avoid using this event if you need to build or run code from the pull request." Several 2026 changes reduce the risk:
- actions/checkout v7 (announced 2026-06-18) refuses common "pwn request" patterns by default, such as checking out fork pull request code in a
pull_request_targetworkflow. The opt-out input isallow-unsafe-pr-checkout, for cases that really need it. GitHub's changelog says the change was also backported to supported major versions except v1, but only workflows that reference a floating major tag such as@v4pick it up automatically. If you pinned actions/checkout to a SHA, you get this protection only after you move the pin to a release that includes it. - Workflow execution protections became generally available on 2026-09-17. They add rules for who can trigger workflows and which events can run them.
- GitHub has announced that pull_request_target will be blocked by default in public repositories from 2026-12-02, on Free, Team, and Enterprise Cloud, unless an event policy allows it. That's according to its 2026-11-02 changelog, which also says private and internal repositories aren't affected. At the time of writing, the main workflow events reference didn't yet describe the block, so confirm the current status and how to allow the trigger before you plan around it.
Scan workflows automatically. CodeQL for GitHub Actions workflows has been generally available since April 2025 and finds patterns such as injection and unsafe triggers. zizmor and Scorecard, covered above, catch unpinned actions, broad permissions, and dangerous triggers. Running one of them on every pull request that touches .github/workflows turns these rules into checks rather than reminders.
Optionally, monitor what the runner talks to. Runtime tools such as StepSecurity's Harden-Runner monitor network egress from runners. They add a layer for detecting exfiltration, but they're a complement to pinning and least privilege, not a replacement.
The same risks in Azure DevOps
Azure Pipelines has the same underlying problem: tasks and extensions are code that runs with your pipeline's access. The controls look different because there are no commit SHAs to pin for Marketplace tasks.
- Decide whether you need Marketplace tasks at all. Microsoft's pipeline security guidance says you can disable installing and running tasks from the Marketplace, which "gives you greater control over the code that runs in a pipeline." If you need some extensions, keep the installed list short and review who can install them.
- Know how task versions move. The tasks documentation says "Pipelines automatically update to use new minor task versions, such as 1.2 to 1.3." Referencing
MyTask@1picks up new minor versions automatically. Where that matters, pin the full version, for exampleGoTool@0.3.1. - Avoid task name collisions. If a custom task's name matches a built-in task, the pipeline runs the built-in one. Reference custom tasks by their GUID so you get the task you meant.
- Limit the job access token. Every job gets an access token, and scripts and tasks in the job can use it. The access token documentation warns that without the Limit job authorization scope settings, a YAML pipeline job gets a collection-scoped token, and "If an adversary is able to gain access to a single pipeline in a single project, they will be able to gain access to any repository in your organization." Turn those settings on, along with Protect access to repositories in YAML pipelines, which is on by default only for organizations and projects created after May 2020.
- Authorize service connections per pipeline. The service connection documentation says granting access to all pipelines "isn't recommended. Instead, authorize each pipeline individually." Use workload identity federation for Azure Resource Manager connections, which has been generally available since February 2024, and avoid broad contributor rights on whole subscriptions. Microsoft also says it's starting to disable service connections automatically after 100 days of inactivity.
- Don't trust log masking to protect you. Azure Pipelines masks secrets in logs, but Microsoft says this filtering "is on a best-effort basis and can't catch every way that secrets can be leaked." A malicious task can encode a secret before printing it.
When an action you use is compromised
Incident write-ups for both tj-actions and Trivy end with the same advice: assume everything the pipeline could reach is exposed. A short runbook makes that faster to act on:
- Find where the action ran. Search your workflow files and lockfiles for the action and any action that wraps it, then list the runs that used an affected version during the published exposure window.
- Block it organization-wide. Add a
!entry to the allowed actions policy, or remove the action, while you investigate. - Treat every secret those jobs could reach as exposed. That includes repository, organization, and environment secrets, cloud credentials reachable through OIDC, package registry tokens, and anything written to disk by earlier steps. Rotate all of them, not only the ones the action took as inputs. The Trivy incident shows what happens when rotation is incomplete.
- Check the logs. Look in the affected runs for unexpected output, such as encoded strings, then delete those logs once you've captured what you need.
- Review what the credentials did. Check the organization audit log and your cloud provider's sign-in and activity logs for use of the exposed tokens during and after the window.
- Pin to a known-good commit or replace the action. Use the version the maintainer or advisory identifies as safe, and verify the SHA belongs to the action's own repository.
If a secret was committed rather than leaked through a pipeline, the rotation steps are similar, and the same principle applies: revoke first, then clean up.
Regulation and guidance
This isn't legal advice, but two frameworks are worth knowing about if your team needs to justify the work.
In the US, CISA and the NSA published joint guidance on defending CI/CD environments in June 2023, "to provide recommendations and best practices for organizations to strengthen the security of their CI/CD pipelines."
In the EU, the Cyber Resilience Act (Regulation (EU) 2024/2847) sets cybersecurity requirements for manufacturers of products with digital elements, including how they handle vulnerabilities. It applies to products, not to the act of running CI, but a build pipeline that pulls unreviewed code is part of how a product is made. If you ship software into the EU, ask your legal or compliance team how the act's timelines apply to you.
A third-party action checklist
- Every third-party action is pinned to a full-length commit SHA with a version comment, or locked through a workflow lockfile.
- Pinned SHAs come from the action's own repository, not a fork.
- Actions nested in composite actions and reusable workflows are covered, by a lockfile or by reviewing what they call.
- Container images are pinned by digest where you reference them.
- An organization policy requires pinning or a lockfile, so new workflows can't skip it.
- Dependabot keeps pins current, and pin bumps are reviewed rather than auto-merged.
- A scanner such as zizmor, Scorecard, or CodeQL runs on workflow changes and reports known-vulnerable actions.
- Every workflow sets permissions explicitly, and older repositories have been checked for a read and write default.
- Secrets are scoped to the jobs that need them, with environment reviewers for sensitive ones.
- Cloud access uses OIDC or workload identity federation, with narrow role assignments.
- Untrusted input reaches scripts only through environment variables.
- pull_request_target is avoided or uses checkout v7 defaults and execution rules.
- In Azure DevOps, Marketplace tasks are disabled or limited, job authorization scope is limited, service connections are authorized per pipeline, and critical tasks are pinned to full versions.
- An incident runbook exists that lists every secret each pipeline can reach.
None of these steps makes a third-party action safe on its own. Together, they mean that a moved tag doesn't change your pipeline, a bad release finds little to steal, and you know what to rotate when the next advisory arrives.



