Skip to content

Update to alpine3.24_emoncms12.1.9 for PHP security fixes (GHSA-w8hw-w9fx-j79w) - #50

Merged
alexandrecuer merged 4 commits into
Open-Building-Management:mainfrom
TrystanLea:update-dependencies
Oct 25, 2026
Merged

alexandrecuer merged 4 commits into
Open-Building-Management:mainfrom
TrystanLea:update-dependencies

Conversation

@TrystanLea

@TrystanLea TrystanLea commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Hello @alexandrecuer , this is claude generated, I'm still reviewing this

Claude generated text:

Updates the add-on build so the image gets PHP 8.4.27. That release fixes GHSA-w8hw-w9fx-j79w and GHSA-6wmf-4rv5-p3rp. Both are critical, unauthenticated RCEs, and the first is confirmed against Apache mod_php, which is the setup this image uses. The image currently published (alpine3.20_emoncms11.9.10) runs PHP 8.3.15.

This is the same update as emoncms/emoncms-docker#59, adapted to the Alpine build.

Alpine packages

php84 8.4.27-r0 is now on the Alpine v3.24 mirrors. A clean build installs it with no extra steps. The earlier version of this PR had a build step that failed on a vulnerable PHP while the mirrors still served 8.4.26. That step has been removed.

Changes

Component Was Now
Alpine (Dockerfile default / workflow default) 3.19 / 3.20 3.24
PHP (Dockerfile default / workflow default) 82 / 83 84 (8.4.27)
MariaDB 10.11 11.8
Redis 7.2 8.8
Mosquitto 2.0.18 2.1.2
Apache 2.4.67 2.4.69
s6-overlay 3.1.6.2 3.2.3.2
phpredis develop (unpinned) 6.3.0 (PHPREDIS_VERSION)
actions/checkout v4 v7
docker/setup-qemu-action, setup-buildx-action, login-action v3 v4
docker/build-push-action v5 v7

config.yaml and CHANGELOG.md are bumped to alpine3.24_emoncms12.1.9, as in the previous release commit.

Fixes the new versions needed

  • PHP packages. Alpine 3.24 has no unversioned php package. Packages are now installed as php$PHP_VER-*, and /usr/bin/php is symlinked if missing.
  • phpize. Alpine only ships phpize84 and php-config84. With the old cd phpredis && phpize && ... chain the build still succeeded, because sh does not stop on failures inside an && list. The result was an image without redis.so and mosquitto.so, where every worker crashed with Class "Redis" not found. The steps now call the versioned tools one per line, and the build checks that both extensions load.
  • Mosquitto-PHP compile error. Alpine 3.24's GCC fails on mosquitto.c:892, because GCC 14 and later treat implicit int-to-pointer conversion as an error. On musl, strerror_r returns int, not char *. The return value is never used, so the build sets -Wno-error=int-conversion. The real fix belongs in openenergymonitor/Mosquitto-PHP.
  • s6-overlay 3.2. The user/user2 bundles moved to /etc/s6-overlay/user-bundles.d. With only the version bumped, the touch calls would fail silently and no service would start. The s6 and extension RUN blocks now use set -ex, so problems like this fail the build.
  • MariaDB 10.11 → 11.8. sql_ready.sh runs mariadb-upgrade on existing installs. It is in the new mariadb-server-utils package and does nothing once the tables are up to date.
  • pip. pip3 install --break-system-packages redis, needed for the USE_REDISPY_APK=0 path on Python 3.14. The default apk path is unchanged.

Upgrade note for existing installs

On first start, the MariaDB datadir in /data/emoncms/mysql is upgraded from 10.11 to 11.8. This cannot be undone, so users should back up first. As in earlier releases, the emoncms database structure should be updated from the admin page after upgrading (emoncms 11.9 → 12.1).

Testing (amd64)

  • docker build --pull --no-cache with BRANCH=stable, EMONCMS_SRC=https://github.com/emoncms/emoncms installs PHP 8.4.27 (php84-8.4.27-r0), MariaDB 11.8.9, Redis 8.8.0 and Mosquitto 2.1.2. phpredis and Mosquitto-PHP load.
  • Fresh install on that image: HTTP 200, schema created, emoncms_mqtt, feedwriter, service-runner and sync_upload running as apache.
  • Earlier tests on the same build, made before the PHP update reached the mirrors:
    • End to end: a user registered, a message published to emon/testnode/power over MQTT appeared as an input.
    • Upgrade: a volume created by alexjunk/emoncms:alpine3.20_emoncms11.9.10 (MariaDB 10.11.14) started on the new image. mariadb-upgrade brought it to 11.8.9, and the user and inputs were kept. On the next restart, the upgrade step reported nothing to do.
  • Not tested: arm64 and arm/v7 builds, and the GitHub Actions major version bumps. The workflow run will cover these.

After merge

Run emoncms docker images to docker hub - mention of emoncms version with the defaults, which are now 3.24 / 84. This publishes alexjunk/emoncms:alpine3.24_emoncms12.1.9, the tag config.yaml now points to. Run the latest workflow as well if you use it.

🤖 Generated with Claude Code

TrystanLea and others added 2 commits October 21, 2026 18:25
PHP 8.4.27 fixes the critical RCEs GHSA-w8hw-w9fx-j79w and
GHSA-6wmf-4rv5-p3rp. The build now refuses to continue if the
installed PHP is older than the patched release for its branch.

- alpine 3.19 -> 3.24, PHP 82 -> 84 (packages installed as phpXX-*)
- s6-overlay 3.1.6.2 -> 3.2.3.2, services registered in user-bundles.d
- phpredis pinned to 6.3.0
- phpize/php-config called by their versioned names, the unversioned
  ones are not provided, which left the image without redis.so and
  mosquitto.so
- Mosquitto-PHP built with -Wno-error=int-conversion for gcc 14+ on musl
- set -e on the build steps so failures stop the build
- mariadb-upgrade at startup for existing databases (10.11 -> 11.8)
- GitHub Actions bumped to current majors, workflow defaults 3.24 / 84

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexandrecuer

Copy link
Copy Markdown
Contributor

@TrystanLea : thanks, will read, because i can change alpine version without modifying the base code
see

alpine_version:

Comment thread Dockerfile
git clone --depth 1 $MOSQUITTO_PHP;\
cd Mosquitto-PHP;\
phpize$PHP_VER;\
# musl strerror_r returns int, not char *, and gcc 14+ makes that an error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably something like that which works both for posix and gnu

PHP_MOSQUITTO_API char *php_mosquitto_strerror_wrapper(int err)
{
    char *buf = ecalloc(256, sizeof(char));

#if defined(__GLIBC__) && defined(_GNU_SOURCE)
    char *msg = strerror_r(err, buf, 256);

    if (msg != buf) {
        char *result = estrdup(msg);
        efree(buf);
        buf = result;
    }
#else
    if (strerror_r(err, buf, 256) != 0) {
        efree(buf);
        return NULL;
    }
#endif

    if (!buf[0]) {
        efree(buf);
        return NULL;
    }

    return buf;
}

@alexandrecuer alexandrecuer Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working nicely on amd

just produced a new image

docker pull alexjunk/emoncms:alpine3.24_emoncms12.2.0
image image

mosquitto is fine

image

Updated version to alpine3.24_emoncms12.2.0 and included security update details.
@alexandrecuer
alexandrecuer merged commit 33f9e19 into Open-Building-Management:main Oct 25, 2026
@alexandrecuer

Copy link
Copy Markdown
Contributor

addon updated
works fine on arm64

image

remember to process to a database update

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants