Schedule icon
Get icon
WorkingDirectory icon
Clone icon
Script icon
Docker icon
Log icon
If icon
SlackIncomingWebhook icon
Set icon

Detect Moved GitHub Actions Tags and Mismatched SHA Pins

Daily check that exact-version GitHub Actions tags never move and SHA pins match their version comment. Alerts Slack on drift, keeps a KV baseline.

Categories
Infrastructure

Pinning an action to a tag trusts that nobody will rewrite the tag. In the tj-actions/changed-files incident, existing version tags were re-pointed at malicious code and every workflow that referenced them ran it. This flow watches for that class of change: it extracts every external action a repository uses, resolves the refs that can be judged against the live GitHub API, and alerts when an immutable-by-convention ref has changed.

How it works

  1. daily fires at 06:30. read_baseline (io.kestra.plugin.core.kv.Get) loads the commit each exact-version tag pointed at the last time findings were delivered.
  2. clone_repository (io.kestra.plugin.git.Clone) checks out the repository and extract_refs lists every uses: that points at another repository, classified as SHA pin, exact tag such as v4.1.1, or floating ref such as v4 or main.
  3. check_refs resolves exact tags and SHA pins that carry an exact version comment through the GitHub commits API. A tag that moved since the baseline is TAG_MOVED. A SHA that no longer matches its commented version is PIN_MISMATCH. Floating refs are listed as advisory because they move by design.
  4. alert (io.kestra.plugin.core.flow.If) posts one Slack message for the whole run, or logs it in dry run.
  5. advance_baseline records the new state last, so a failed alert is repeated instead of lost.

What you get

  • Alerts only for refs that should never change, so the signal is not buried under every routine v4 release.
  • A status table for every external reference, including pinned and floating ones, with the first file that uses it.
  • A failed run, not a green one, when the GitHub API is unreachable or rate limited for every ref that needed checking.

Who it's for

  • Platform and DevSecOps teams guarding CI/CD workflows against supply-chain poisoning.
  • Engineering organizations seeking automated alerts when third-party Action tags are mutated.

Why orchestrate this with Kestra

  • Built-in KV store maintains baseline commit hashes across executions without requiring external databases.
  • Declarative scheduling and secrets management automate daily audits without leaking tokens or webhook URLs.
  • Native Docker execution isolates Python inspection dependencies safely.

Prerequisites

  • Network access to clone public repositories and query the GitHub API (api.github.com).
  • Python runtime capable of running standard library scripts inside the Docker runner.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL to deliver security alerts (only accessed when dry_run is false).
  • GITHUB_TOKEN: GitHub personal access token to raise API rate limits from 60 to 5,000 requests/hour (only accessed when use_github_token is true).

Quick start

  1. Execute with dry_run: true to run an audit of kestra-io/kestra without modifying KV state or posting to Slack.
  2. Check the execution logs under report to review scanned references, pin statuses, and unpinned actions.
  3. Configure SLACK_WEBHOOK_URL in your namespace secrets, set dry_run: false, and run again to seed your initial KV baseline.
  4. Enable the daily trigger to keep watching for tag mutability automatically.

How to extend

  • Route alerts to PagerDuty or Microsoft Teams for urgent TAG_MOVED incidents.
  • Iterate across multiple repositories within your GitHub organization using a Loop task.
  • Add automated PR creation or issue tracking when unpinned or floating references are detected.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.