[Experiment] Switch runtime base to python:3.12-alpine (musl) to fix CVE-2026-5450 - #208
Draft
dimittal wants to merge 3 commits into
Draft
[Experiment] Switch runtime base to python:3.12-alpine (musl) to fix CVE-2026-5450#208dimittal wants to merge 3 commits into
dimittal wants to merge 3 commits into
Conversation
Eliminates CVE-2026-5450 (glibc scanf %mc heap overflow, CVSS 9.8) by moving away from glibc entirely. musl libc is unaffected by the CVE since it has its own scanf implementation. Empirical comparison vs trixie v3 (jf docker scan against trialwyikk8): | Metric | Trixie v3 | Alpine | Δ | | --- | --- | --- | --- | | CVE-2026-5450 | Critical, Applicable | gone | fixed | | Critical total | 1 | 0 | -1 | | High total | 12 | 4 | -8 | | Medium total | 18 | 13 | -5 | | Low total | 50 | 0 (2 Unknown) | -48 | | Secrets (the 59) | 59 | 59 (identical) | same | | Image size | 365 MB | 272 MB | -25% | The 4 remaining Highs: - CVE-2018-20225 (pip, disputed) — already in our triage - CVE-2026-3805 (curl/libcurl 8.17.0-r1) — Alpine 3.23 awaiting backport (fix exists in 8.19.0-r0 on edge) - CVE-2026-27135 (nghttp2-libs) — Xray CSA marks Not Applicable Build deltas vs the trixie Dockerfile: - Builder: +git, +mariadb-dev, +pkgconfig (apk equivalents) - Runtime: +bash, +tzdata, +musl-locales, +libstdc++, +libgcc, +libxml2, +libxslt, +lz4-libs (clickhouse-connect dep), +mariadb-connector-c, +procps-ng, +file, +ca-certificates - nginx config path moved from /etc/nginx/sites-available/default to /etc/nginx/http.d/default.conf (Alpine convention) - chown changed from www-data to nginx (nginx package's own user on Alpine) - PYTHONTHREADSTACKSIZE=8388608 set explicitly to match glibc default; musl's 80KB default would segfault Celery threadpool workers under load Smoke-tested 27 critical Python imports (django, celery, cryptography, psycopg2, mysqlclient, pymysql, google.auth, google.cloud, kubernetes, msal, azure.identity, boto3, awscli, oauthlib, requests_oauthlib, sqlalchemy, clickhouse_connect, slack_sdk, prometheus_client, grpc, jwt, yaml, drdroid_debug_toolkit, etc.) — all pass. Smoke-tested nginx config (`nginx -t` passes), kubectl install (v1.36.0), bash and otterize. NOT YET TESTED: - End-to-end agent boot (gunicorn + Celery worker + Celery beat + nginx orchestration) under realistic load - Connector calls against live targets (Grafana, Datadog, K8s, AWS, Azure, GCP, ArgoCD) - Helm chart deployment in a Kind cluster - musl thread stack sizing under Celery load (mitigated by PYTHONTHREADSTACKSIZE but unverified) - DNS resolver edge cases vs glibc Treat this branch as an experiment; do not merge until the above runtime tests are complete. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…iment/alpine-base
Removes `packaged-helm/drd-vpc-agent-0.1.0.tgz` and `packaged-helm/drd-vpc-agent-0.1.1.tgz`; keeps only the latest 0.1.2.tgz. Regenerates `packaged-helm/index.yaml` to point at the latest version. Each older tgz contains pre-templated `DRD_CLOUD_API_TOKEN` references that trip Xray's secret-name heuristic; with three versions in the release bundle the same false-positive class fires three times. Dropping the older two cuts ~20 of the 116 violations reported in `cloud-drdroidlab:1.0.5` without touching any active artifact. The pre-existing `index.yaml` already pointed to 0.1.0 only (it was generated 2025-11-12, before 0.1.1 / 0.1.2 were added to the directory). After this commit the published helm repo serves 0.1.2 instead. Customers pulling from `https://drdroidlab.github.io/drd-vpc-agent/packaged-helm/` who pinned to 0.1.0 will need to update to 0.1.2 — see the chart upgrade-notes for the operator. New installs are unaffected. Justification for all remaining 96 violations is documented locally in `security/xray-1.0.5-justifications.md`; the 7-rule Xray ignore-rule structure in section E covers everything that's left. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status: DRAFT — runtime smoke testing pending
This branch swaps the runtime base image from
python:3.12-slim-trixie(glibc 2.41) topython:3.12-alpine(musl 1.2.5) to eliminate CVE-2026-5450 (glibc scanf %mc heap overflow, CVSS 9.8) and dramatically reduce the OS-level CVE surface.Empirical comparison (jf docker scan against trialwyikk8 — same Xray engine as customer's entplus.jfrog.io)
The 4 remaining Highs are not net-new:
CVE-2018-20225(pip) — disputed CVE, already in our triage as a known false positive.CVE-2026-3805x2 (curl/libcurl 8.17.0-r1 on Alpine 3.23) — fix exists upstream in 8.19.0-r0 (currently on Alpine edge); 3.23 backport pending. Same situation as Debian backports.CVE-2026-27135(nghttp2-libs) — Xray Contextual Analysis marks Not Applicable.Dockerfile deltas
Builder stage (
python:3.12-bookworm→python:3.12-alpine):apt-get install build-essential libpq-dev gettext curl→apk add build-base postgresql-dev mariadb-dev libffi-dev openssl-dev libxml2-dev libxslt-dev pkgconfig gettext curl git cargo rustapk add cargo rust(replaces curl+rustup approach; needed forcryptographysource build when no musllinux wheel)Runtime stage (
python:3.12-slim-trixie→python:3.12-alpine):apt-get install libpq5 nginx procps curl→apk add libpq nginx bash tzdata musl-locales libstdc++ libgcc libxml2 libxslt lz4-libs mariadb-connector-c procps-ng curl file ca-certificatesnginx.defaultdeployed to/etc/nginx/http.d/default.confinstead of/etc/nginx/sites-available/default(Alpine convention)chown www-data:www-data /code→chown nginx:nginx /code(nginx package's user on Alpine)ENV PYTHONTHREADSTACKSIZE=8388608set explicitly — musl's 80KB default segfaults Celery threadpool workers; this matches glibc's 8MB defaultAll existing scrub steps (RECORD, METADATA truncation, .pyi removal, sed replacements) ported as-is — they're plain
find/sed/rmcommands that work identically on BusyBox.Smoke tests passed
nginx -tpassesNOT YET TESTED — required before merging out of draft
PYTHONTHREADSTACKSIZEset but unverified)getaddrinfois stricter than glibc's; some.local/ mDNS / NIS edge cases differ)musl-localesinstalled but locale catalogs not exercised)How to test
Local Kind smoke test (per existing
deploy_local.sh):Then exercise each connector via the dashboard / CLI and verify the agent registers cleanly with drcloud.
🤖 Generated with Claude Code