Skip to content

Pin release workflow dependencies to immutable commit SHAs #368

Description

@alwell-kevin

Summary

The release and GPG workflows currently execute third-party GitHub Actions using mutable tag references. These jobs handle sensitive release material, including GPG signing keys, passphrases, and release/publish tokens. If an upstream action tag is moved or the upstream action repository is compromised, the next workflow run could execute attacker-controlled code with access to signing and publishing credentials.

Affected workflow references

  • .github/workflows/release.yaml

    • actions/checkout@v3
    • actions/setup-go@v3
    • crazy-max/ghaction-import-gpg@v5
    • goreleaser/goreleaser-action@v3.0.0
    • version: latest for the GoReleaser binary
  • .github/workflows/gpginfo.yaml

    • hashicorp/ghaction-import-gpg@v2.1.0

Required changes

Pin GitHub Actions to immutable commit SHAs instead of major/minor/release tags, and pin the GoReleaser binary version instead of using latest.

Recommended current pins:

uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2

Replace:

version: latest

with:

version: v2.16.0

For .github/workflows/gpginfo.yaml, either pin the existing HashiCorp fork:

uses: hashicorp/ghaction-import-gpg@78437f97569a473e42b227be84d4084c2dfb49ba # v2.1.0

or migrate it to the maintained crazy-max/ghaction-import-gpg action if compatibility allows.

Security rationale

Tag refs such as @v5, @v3, and even exact release tags like @v3.0.0 are mutable Git refs. GitHub Actions resolves them at workflow runtime. If an upstream maintainer account or repository is compromised and the tag is retargeted, this repository will run whatever code the tag points to during the next release workflow execution.

Pinning to a full commit SHA prevents tag retargeting from changing the code executed by the workflow.

This is especially important here because the affected workflows expose:

  • GPG_PRIVATE_KEY
  • PASSPHRASE
  • release signing context
  • GITHUB_TOKEN
  • release artifact publishing capability

Acceptance criteria

  • All uses: entries in release/signing workflows are pinned to full 40-character commit SHAs.
  • GoReleaser binary version is pinned to a fixed release, not latest.
  • Workflow still signs and publishes releases successfully.
  • Dependabot/Renovate is configured, if available, to propose SHA-pinned action updates.
  • GITHUB_TOKEN permissions are minimized to only what the release job needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions