<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5" -->

---
title: How to Prevent Poisoned GitHub Actions Dependencies
description: GitHub Actions referenced by a floating tag (branch, version tag) can silently execute different code later if the tag is moved by a compromised maintainer or...
canonical: https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Prevent Poisoned GitHub Actions Dependencies | daily.dev
og:description: GitHub Actions referenced by a floating tag (branch, version tag) can silently execute different code later if the tag is moved by a compromised maintainer or...
og:url: https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5
og:image: https://api.daily.dev/og/posts/mgd2vsXf5.png
og:image:alt: How to Prevent Poisoned GitHub Actions Dependencies
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Prevent Poisoned GitHub Actions Dependencies

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · [@rufilboss](https://daily.dev/rufilboss) · 9 min read · 0 upvotes · 0 comments

## Summary

GitHub Actions referenced by a floating tag (branch, version tag) can silently execute different code later if the tag is moved by a compromised maintainer or attacker, creating a CI/CD supply chain risk. The guidance covers pinning every 'uses:' reference to a full 40-character commit SHA, validating that the SHA matches the reviewed release tag via a shell script, restricting permitted actions through an organization or repository allowlist, enabling Dependabot for GitHub Actions to open reviewable update pull requests, and enforcing SHA pins in CI using a linter (actionlint) plus a grep-based check for floating tags. It also covers vetting third-party actions, applying least-privilege workflow permissions, and edge cases like emergency patches, reusable workflows, and annotated tags that need resolving to a commit before pinning.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/how-to-prevent-poisoned-github-actions-dependencies>

## Questions this post answers

### Why is pinning a GitHub Action to a version tag like @v4 considered insecure?

A version tag such as @v4 is mutable, meaning the same tag label can later point to different, possibly malicious, code if the publisher or an attacker moves it. Only a full 40-character commit SHA identifies one immutable commit, so the workflow only changes when the reference is explicitly updated in the repository.

_Developers hardening CI pipelines can find dependency-pinning breakdowns like this one through daily.dev._

### How do I validate that a GitHub Actions commit SHA actually corresponds to the release tag I reviewed?

Use git ls-remote against the repository's refs/tags/<version> and refs/tags/<version>^{} to resolve the tag to its commit, then compare that resolved SHA against the SHA recorded in the workflow file, failing the check on a mismatch. This confirms the pinned commit matches the release you actually reviewed rather than a different commit under the same tag.

_Teams building CI security gates can track validation patterns like this via daily.dev._

### How do I set up Dependabot to update pinned GitHub Actions SHAs automatically?

Create a .github/dependabot.yml file with package-ecosystem set to github-actions, a directory of / and a weekly schedule, grouping action updates under a wildcard pattern. Dependabot then opens pull requests when pinned SHAs have newer releases, giving a reviewable place to inspect permission changes, script changes, and new transitive dependencies before merging.

_Anyone automating dependency review for CI workflows can surface guides like this on daily.dev._

## Similar posts on daily.dev

- [Securing GitHub Actions CI dependencies: Recipe card](https://daily.dev/posts/securing-github-actions-ci-dependencies-recipe-card-ttkzb5tpj) · CNCF · 0 upvotes · 0 comments
- [Is GitHub Actions Putting Your Software at Risk?](https://daily.dev/posts/is-github-actions-putting-your-software-at-risk--a2b2a1jji) · Atomic Spin · 0 upvotes · 0 comments
- [The Comforting Lie Of SHA Pinning](https://daily.dev/posts/the-comforting-lie-of-sha-pinning-ezbly84cs) · Lobsters · 0 upvotes · 0 comments
- [GitHub Actions Cache Poisoning is eating open source](https://daily.dev/posts/github-actions-cache-poisoning-is-eating-open-source-dyhf0mvj0) · Neciu Dan · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#cicd](https://daily.dev/tags/cicd), [#github-actions](https://daily.dev/tags/github-actions), [#devsecops](https://daily.dev/tags/devsecops), [#dependabot](https://daily.dev/tags/dependabot)

[View this post on daily.dev](https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Prevent Poisoned GitHub Actions Dependencies","url":"https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5"},"datePublished":"2026-09-18T18:31:29.679Z","dateModified":"2026-09-19T15:00:13.875Z","description":"GitHub Actions referenced by a floating tag (branch, version tag) can silently execute different code later if the tag is moved by a compromised maintainer or...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/99b69a4ca75850619e1c1baec2f4a6ce?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/99b69a4ca75850619e1c1baec2f4a6ce?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Ilyas Rufai","url":"https://daily.dev/rufilboss","image":"https://avatars.githubusercontent.com/u/69714197?v=4","description":"DevOps Engineer","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,cicd,github-actions,devsecops,dependabot","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"How to Prevent Poisoned GitHub Actions Dependencies"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-prevent-poisoned-github-actions-dependencies-mgd2vsxf5#faq","mainEntity":[{"@type":"Question","name":"Why is pinning a GitHub Action to a version tag like @v4 considered insecure?","acceptedAnswer":{"@type":"Answer","text":"A version tag such as @v4 is mutable, meaning the same tag label can later point to different, possibly malicious, code if the publisher or an attacker moves it. Only a full 40-character commit SHA identifies one immutable commit, so the workflow only changes when the reference is explicitly updated in the repository. Developers hardening CI pipelines can find dependency-pinning breakdowns like this one through daily.dev."}},{"@type":"Question","name":"How do I validate that a GitHub Actions commit SHA actually corresponds to the release tag I reviewed?","acceptedAnswer":{"@type":"Answer","text":"Use git ls-remote against the repository's refs/tags/\u003cversion\u003e and refs/tags/\u003cversion\u003e^{} to resolve the tag to its commit, then compare that resolved SHA against the SHA recorded in the workflow file, failing the check on a mismatch. This confirms the pinned commit matches the release you actually reviewed rather than a different commit under the same tag. Teams building CI security gates can track validation patterns like this via daily.dev."}},{"@type":"Question","name":"How do I set up Dependabot to update pinned GitHub Actions SHAs automatically?","acceptedAnswer":{"@type":"Answer","text":"Create a .github/dependabot.yml file with package-ecosystem set to github-actions, a directory of / and a weekly schedule, grouping action updates under a wildcard pattern. Dependabot then opens pull requests when pinned SHAs have newer releases, giving a reviewable place to inspect permission changes, script changes, and new transitive dependencies before merging. Anyone automating dependency review for CI workflows can surface guides like this on daily.dev."}}]}
```

