From 39ce920d934bd37dd1d0743479005666061f90b7 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 21 Oct 2026 11:56:01 -0300 Subject: [PATCH 1/3] fix(security): require PHP patched for critical RCEs Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .docker/Dockerfile.apache | 7 ++++++- .docker/Dockerfile.fpm | 7 ++++++- .github/workflows/build_publish.yml | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile.apache b/.docker/Dockerfile.apache index fdd06970..66b93836 100644 --- a/.docker/Dockerfile.apache +++ b/.docker/Dockerfile.apache @@ -1,4 +1,9 @@ -FROM php:8.3-apache +FROM php:8.3.36-apache + +# Stop builds before publication when upstream PHP still lacks the October 2026 RCE fixes. +# CVE-2026-109618 / CVE-2026-109619; unsupported PHP branches fail closed. +RUN php -r '$minimum = ["8.2" => "8.2.35", "8.3" => "8.3.36", "8.4" => "8.4.27", "8.5" => "8.5.12"]; $series = PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION; if (!isset($minimum[$series]) || version_compare(PHP_VERSION, $minimum[$series], "<")) { fwrite(STDERR, "Unpatched or unsupported PHP runtime: " . PHP_VERSION . PHP_EOL); exit(1); }' + LABEL vendor="Mautic" LABEL maintainer="LibreCode coop" diff --git a/.docker/Dockerfile.fpm b/.docker/Dockerfile.fpm index 9effafea..b54f092b 100644 --- a/.docker/Dockerfile.fpm +++ b/.docker/Dockerfile.fpm @@ -1,4 +1,9 @@ -FROM php:8.3-fpm +FROM php:8.3.36-fpm + +# Stop builds before publication when upstream PHP still lacks the October 2026 RCE fixes. +# CVE-2026-109618 / CVE-2026-109619; unsupported PHP branches fail closed. +RUN php -r '$minimum = ["8.2" => "8.2.35", "8.3" => "8.3.36", "8.4" => "8.4.27", "8.5" => "8.5.12"]; $series = PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION; if (!isset($minimum[$series]) || version_compare(PHP_VERSION, $minimum[$series], "<")) { fwrite(STDERR, "Unpatched or unsupported PHP runtime: " . PHP_VERSION . PHP_EOL); exit(1); }' + LABEL vendor="Mautic" LABEL maintainer="LibreCode coop" diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 94e1c052..1aa46277 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -1,6 +1,8 @@ name: Build and publish a Docker image on: + schedule: + - cron: '23 4 * * *' push: branches: - main @@ -83,6 +85,7 @@ jobs: - name: Build and publish container image uses: docker/build-push-action@v6 with: + pull: true push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || inputs.publish }} context: .docker platforms: linux/amd64,linux/arm64 From c54902b46e15b28183e06e469d89c459ed608476 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 21 Oct 2026 12:02:23 -0300 Subject: [PATCH 2/3] test(ci): verify patched PHP before registry publication Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .docker/scripts/entrypoint_mautic_cron.sh | 1 + .github/workflows/build_publish.yml | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.docker/scripts/entrypoint_mautic_cron.sh b/.docker/scripts/entrypoint_mautic_cron.sh index 586359c7..92d8fd20 100644 --- a/.docker/scripts/entrypoint_mautic_cron.sh +++ b/.docker/scripts/entrypoint_mautic_cron.sh @@ -65,6 +65,7 @@ chmod 777 /tmp/stdout # so the jobs need an explicit shell environment. { declare -p | grep -E '^(declare -x (PHP_INI_VALUE_|MAUTIC_DB_|MAUTIC_SITE_URL))' + # shellcheck disable=SC2016 -- the expression must remain literal in cron.env. printf '%s\n' 'if [ -n "${MAUTIC_DB_NAME:-}" ] && [ -z "${MAUTIC_DB_DATABASE:-}" ]; then export MAUTIC_DB_DATABASE="$MAUTIC_DB_NAME"; fi' } > /tmp/cron.env diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 1aa46277..ed456b34 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -1,6 +1,9 @@ name: Build and publish a Docker image on: + pull_request: + branches: + - main schedule: - cron: '23 4 * * *' push: @@ -36,7 +39,7 @@ jobs: name: Build image runs-on: ubuntu-latest env: - MAUTIC_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.mautic_version || (github.ref == 'refs/heads/main' && '7.x-dev') || github.ref_name }} + MAUTIC_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.mautic_version || (github.event_name == 'pull_request' && '7.x-dev') || (github.ref == 'refs/heads/main' && '7.x-dev') || github.ref_name }} strategy: fail-fast: false matrix: @@ -60,6 +63,7 @@ jobs: type=semver,pattern={{major}}.{{minor}},value=${{ env.MAUTIC_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.overwrite_latest_minor }} type=semver,pattern={{major}},value=${{ env.MAUTIC_VERSION }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.overwrite_latest_major }} type=raw,value=7.x-dev,enable=${{ github.ref == 'refs/heads/main' }},suffix=-${{ matrix.image_type }} + type=raw,value=pr-check,enable=${{ github.event_name == 'pull_request' }} type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag_as_latest && matrix.image_type == 'apache' }},suffix= flavor: | latest=false @@ -77,6 +81,7 @@ jobs: restore-keys: | ${{ matrix.image_type }}-buildx- - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io From 016a244bf250f616e790fa7fb82463f6c79f6000 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:14:56 -0300 Subject: [PATCH 3/3] fix(ci): pin patched PHP and correct PR validation Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .docker/Dockerfile.apache | 5 +---- .docker/Dockerfile.fpm | 5 +---- .docker/scripts/entrypoint_mautic_cron.sh | 2 +- .github/workflows/build_publish.yml | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.docker/Dockerfile.apache b/.docker/Dockerfile.apache index 66b93836..03ef79b6 100644 --- a/.docker/Dockerfile.apache +++ b/.docker/Dockerfile.apache @@ -1,8 +1,5 @@ -FROM php:8.3.36-apache +FROM php:8.3.36-apache@sha256:756c2884677bedea30afaa95811b42cd3ff251203291c5820c1ad209e86c9fb4 -# Stop builds before publication when upstream PHP still lacks the October 2026 RCE fixes. -# CVE-2026-109618 / CVE-2026-109619; unsupported PHP branches fail closed. -RUN php -r '$minimum = ["8.2" => "8.2.35", "8.3" => "8.3.36", "8.4" => "8.4.27", "8.5" => "8.5.12"]; $series = PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION; if (!isset($minimum[$series]) || version_compare(PHP_VERSION, $minimum[$series], "<")) { fwrite(STDERR, "Unpatched or unsupported PHP runtime: " . PHP_VERSION . PHP_EOL); exit(1); }' LABEL vendor="Mautic" diff --git a/.docker/Dockerfile.fpm b/.docker/Dockerfile.fpm index b54f092b..369623cd 100644 --- a/.docker/Dockerfile.fpm +++ b/.docker/Dockerfile.fpm @@ -1,8 +1,5 @@ -FROM php:8.3.36-fpm +FROM php:8.3.36-fpm@sha256:d0dea3f5d95314eac94a732469f4cf0ee658a22c2ce3f2612272b9d5b42d1a72 -# Stop builds before publication when upstream PHP still lacks the October 2026 RCE fixes. -# CVE-2026-109618 / CVE-2026-109619; unsupported PHP branches fail closed. -RUN php -r '$minimum = ["8.2" => "8.2.35", "8.3" => "8.3.36", "8.4" => "8.4.27", "8.5" => "8.5.12"]; $series = PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION; if (!isset($minimum[$series]) || version_compare(PHP_VERSION, $minimum[$series], "<")) { fwrite(STDERR, "Unpatched or unsupported PHP runtime: " . PHP_VERSION . PHP_EOL); exit(1); }' LABEL vendor="Mautic" diff --git a/.docker/scripts/entrypoint_mautic_cron.sh b/.docker/scripts/entrypoint_mautic_cron.sh index 92d8fd20..3b63faec 100644 --- a/.docker/scripts/entrypoint_mautic_cron.sh +++ b/.docker/scripts/entrypoint_mautic_cron.sh @@ -65,7 +65,7 @@ chmod 777 /tmp/stdout # so the jobs need an explicit shell environment. { declare -p | grep -E '^(declare -x (PHP_INI_VALUE_|MAUTIC_DB_|MAUTIC_SITE_URL))' - # shellcheck disable=SC2016 -- the expression must remain literal in cron.env. + # shellcheck disable=SC2016 printf '%s\n' 'if [ -n "${MAUTIC_DB_NAME:-}" ] && [ -z "${MAUTIC_DB_DATABASE:-}" ]; then export MAUTIC_DB_DATABASE="$MAUTIC_DB_NAME"; fi' } > /tmp/cron.env diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index ed456b34..84f077cb 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -4,8 +4,6 @@ on: pull_request: branches: - main - schedule: - - cron: '23 4 * * *' push: branches: - main @@ -91,7 +89,7 @@ jobs: uses: docker/build-push-action@v6 with: pull: true - push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || inputs.publish }} + push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || inputs.publish == true }} context: .docker platforms: linux/amd64,linux/arm64 file: .docker/Dockerfile.${{ matrix.image_type }}