From e92e7edd7008074c37802007710846bde2139ab5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 3 Mar 2026 04:22:39 +0000 Subject: [PATCH] fix: prevent stale-SHA checkout and pin caddy-security in weekly security rebuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scheduled weekly rebuild was failing because GitHub Actions froze github.sha at job-queue time. When the Sunday cron queued a job on March 1 with Feb 23 code (CADDY_VERSION=2.11.0-beta.2), that job ran two days later on March 3 still using the old code, missing the caddy version fix that had since landed on main. Additionally, caddy-security was unpinned, so xcaddy auto-resolved it to v1.1.36 which requires caddy/v2@v2.11.1 — conflicting with xcaddy's internally bundled v2.11.0-beta.2 reference. - Add ref: github.ref_name to checkout step so the rebuild always fetches current branch HEAD at run time, not the SHA frozen at queue time - Add CADDY_SECURITY_VERSION=1.1.36 ARG to pin the caddy-security plugin to a known-compatible version; pass it via --with so xcaddy picks up the pinned release - Add --with github.com/caddyserver/caddy/v2@v${CADDY_TARGET_VERSION} to force xcaddy to use the declared Caddy version, overriding its own internal go.sum pin for caddy - Add Renovate custom manager for CADDY_SECURITY_VERSION so future caddy-security releases trigger an automated PR instead of silently breaking the build Fixes weekly security rebuild CI failures introduced ~Feb 22 when caddy-security v1.1.36 was published. --- .github/renovate.json | 13 +++++++++++++ .github/workflows/security-weekly-rebuild.yml | 5 +++++ Dockerfile | 6 +++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index ff5961f8..2ad2fa19 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -36,6 +36,19 @@ "platformAutomerge": true, "customManagers": [ + { + "customType": "regex", + "description": "Track caddy-security plugin version in Dockerfile", + "managerFilePatterns": [ + "/^Dockerfile$/" + ], + "matchStrings": [ + "ARG CADDY_SECURITY_VERSION=(?[^\\s]+)" + ], + "depNameTemplate": "github.com/greenpau/caddy-security", + "datasourceTemplate": "go", + "versioningTemplate": "semver" + }, { "customType": "regex", "description": "Track Go dependencies patched in Dockerfile for Caddy CVE fixes", diff --git a/.github/workflows/security-weekly-rebuild.yml b/.github/workflows/security-weekly-rebuild.yml index 1039e650..6394544c 100644 --- a/.github/workflows/security-weekly-rebuild.yml +++ b/.github/workflows/security-weekly-rebuild.yml @@ -36,6 +36,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + # Explicitly fetch the current HEAD of the ref at run time, not the + # SHA that was frozen when this scheduled job was queued. Without this, + # a queued job can run days later with stale code. + ref: ${{ github.ref_name }} - name: Normalize image name run: | diff --git a/Dockerfile b/Dockerfile index f26ed1e9..19fb5cc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,8 @@ ARG CADDY_VERSION=2.11.1 ARG CADDY_CANDIDATE_VERSION=2.11.1 ARG CADDY_USE_CANDIDATE=0 ARG CADDY_PATCH_SCENARIO=B +# renovate: datasource=go depName=github.com/greenpau/caddy-security +ARG CADDY_SECURITY_VERSION=1.1.36 ## When an official caddy image tag isn't available on the host, use a ## plain Alpine base image and overwrite its caddy binary with our ## xcaddy-built binary in the later COPY step. This avoids relying on @@ -202,6 +204,7 @@ ARG CADDY_VERSION ARG CADDY_CANDIDATE_VERSION ARG CADDY_USE_CANDIDATE ARG CADDY_PATCH_SCENARIO +ARG CADDY_SECURITY_VERSION # renovate: datasource=go depName=github.com/caddyserver/xcaddy ARG XCADDY_VERSION=0.4.5 @@ -229,7 +232,8 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ echo "Stage 1: Generate go.mod with xcaddy..."; \ # Run xcaddy to generate the build directory and go.mod GOOS=$TARGETOS GOARCH=$TARGETARCH xcaddy build v${CADDY_TARGET_VERSION} \ - --with github.com/greenpau/caddy-security \ + --with github.com/caddyserver/caddy/v2@v${CADDY_TARGET_VERSION} \ + --with github.com/greenpau/caddy-security@v${CADDY_SECURITY_VERSION} \ --with github.com/corazawaf/coraza-caddy/v2 \ --with github.com/hslatman/caddy-crowdsec-bouncer@v0.10.0 \ --with github.com/zhangjiayin/caddy-geoip2 \