Skip to content

Harden GitHub Actions workflows#105

Open
vmercierfr wants to merge 1 commit into
qonto:mainfrom
vmercierfr:pin-workflow-version
Open

Harden GitHub Actions workflows#105
vmercierfr wants to merge 1 commit into
qonto:mainfrom
vmercierfr:pin-workflow-version

Conversation

@vmercierfr

Copy link
Copy Markdown
Collaborator

Goal

Harden GitHub Actions workflows against supply chain attacks by pinning all action references to immutable commit SHAs and adding integrity verification for downloaded binaries.

Why

A security audit flagged multiple high-confidence findings across our CI/CD workflows:

  • Unpinned actions in high-privilege workflows — All actions used mutable major-version tags (e.g., @v4, @v5) instead of pinned commit SHAs. In workflows with contents: write, id-token: write, pull-requests: write, or security-events: write permissions, a compromised upstream action could steal OIDC tokens, push malicious releases, exfiltrate code, or suppress security findings.
  • Binary downloads without integrity verification — Helm and kubeconform binaries were downloaded and executed without checksum validation, leaving the pipeline vulnerable to CDN compromise or DNS hijacking.

These are well-known supply chain attack vectors (ref: tj-actions/changed-files compromise, March 2025).

How

Pinned actions to full commit SHAs

All actions across 3 workflow files are now pinned to their latest patch-level commit SHA with a version comment for readability:

Workflow Actions pinned
build.yaml actions/checkout, aws-actions/configure-aws-credentials, aws-actions/amazon-ecr-login, actions/setup-go, docker/setup-qemu-action, goreleaser/goreleaser-action
linter.yaml actions/checkout, actions/setup-go, golangci/golangci-lint-action
test.yaml actions/checkout, actions/setup-go, irongut/CodeCoverageSummary, jwalton/gh-find-current-pr, marocchino/sticky-pull-request-comment, docker/setup-qemu-action, goreleaser/goreleaser-action, bridgecrewio/checkov-action, github/codeql-action/upload-sarif

Added SHA256 checksum verification for binary downloads

  • Helm v3.12.0 (build.yaml): verified against official release checksum da36e117...
  • kubeconform v0.6.2 (test.yaml): verified against official release checksum d2a10db6...

Both steps will now fail-fast if the downloaded binary doesn't match the expected hash.

Release

No functional changes. Existing Dependabot configuration will automatically propose PRs when pinned SHAs have newer versions available.

All actions in this workflow use mutable major-version tags (e.g., actions/checkout@v4, goreleaser/goreleaser-action@v5, aws-actions/configure-aws-credentials@v4) instead of pinned commit SHAs. This workflow has contents: write and id-token: write permissions and produces official releases. If any upstream action maintainer's account is compromised, or a tag is force-pushed with malicious code, the attacker could: (1) steal the OIDC token to assume the AWS IAM role arn:aws:iam::202662887508:role/ecr-prometheus-rds-exporter, (2) steal GITHUB_TOKEN with write access to create/modify releases, (3) inject malicious code into release artifacts (binaries, Docker images, Helm charts) affecting all downstream consumers.

Signed-off-by: Vincent Mercier <vmercier@gmail.com>
@vmercierfr vmercierfr requested a review from dverite May 11, 2026 15:21
@vmercierfr vmercierfr added the enhancement New feature or request label May 11, 2026
@vmercierfr vmercierfr changed the title Harden GitHub Actions workflows#277 Harden GitHub Actions workflows May 11, 2026
@vmercierfr vmercierfr requested review from dcupif, jbourdale and qfritz May 11, 2026 15:21
@vmercierfr vmercierfr enabled auto-merge May 11, 2026 15:25
@dverite

dverite commented May 19, 2026

Copy link
Copy Markdown
Collaborator

It seems safer indeed to use the immutables hashes instead of the tags.

A few comments:

  1. The commit messages mentions "(1) steal the OIDC token to assume the AWS IAM role arn:aws:iam::202662887508:role/ecr-prometheus-rds-exporter". This reference to rds-exporter seems like a copy-pasto? Or why would assuming specifically that role would be relevant to postgresql-partition-manager?

  2. The current commit message reads a bit like a recipe to hack a project. It could be shortened to something like "For safety, use pinned commit SHAs instead of mutable major-version tags in the github actions workflow".

  3. The PR mentions "adding integrity verification for downloaded binaries" concerning Helm and kubeconform but I don't find related changes in the commit. Am I missing something or misunderstanding?

  4. How and when are we going to update the immutable hashes in the future? Manually? Are there howto/best practices /typical process to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants