Repository navigation
fix(security): move ingestion images to Python 3.12, drop build tooling, upgrade datamodel-code-gen. - #30911
Conversation
python:3.10-slim-bookworm is EOL and no longer rebuilt, so its Debian layer and bundled Python tooling are frozen. Move all four ingestion images to python:3.12-slim-bookworm / apache/airflow:3.2.2-python3.12. - ingestion/Dockerfile pinned the Airflow *Python 3.10* constraints file while building on a python3.12 base; point it at constraints-3.12.txt. - Regenerate the vendored airflow-constraints-3.2.2.txt from upstream's 3.12 variant. Both come from the same 2026-05-26 generation run, so this is the matching sibling: it drops the py<3.11 backports (backports.strenum, exceptiongroup, tomli) and refreshes numpy/scipy/scikit-learn. Verified openmetadata-airflow-apis still installs under it and that the new setuptools==82.0.1 pin stays inert against the deliberate setuptools<81. - Upgrade the interpreter-level pip to a pinned 26.2 before dropping privileges. The existing `pip install --upgrade pip` runs after the USER switch, so it only reached ~/.local and left the base image's copy on disk for scanners (CVE-2025-8869, CVE-2026-3219, CVE-2026-6357, CVE-2026-8643, fixed in 26.1.2). Python 3.12 alone is not enough - its bundled pip is 25.0.1. The airflow images need the explicit /usr/local/bin/python: as root, `pip` hits airflow's wrapper and exits 1, and bare `python` resolves to /home/airflow/.local/bin/python, so both would miss the very copy this line exists to fix. - Uninstall datamodel-code-generator and the black it depends on after the codegen step in the two CI images. Neither is imported at runtime; they exist only to run datamodel_generation.py, and account for eight HIGH findings. Bumping the pin is not an option - both codegen scripts monkeypatch datamodel_code_generator.model.pydantic.types.IMPORT_SECRET_STR (the CustomSecretStr swap), which no longer exists in 0.26+. The uninstall runs after the final pip install so no extra can pull them back in. Python 3.12 also ships ensurepip without setuptools/wheel, removing the vendored wheel-0.45.1 behind CVE-2026-24049. Co-Authored-By: Claude Opus 5 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
There was a problem hiding this comment.
Pull request overview
This PR updates OpenMetadata’s ingestion Docker images to Python 3.12–based upstream images and tightens what build tooling ends up shipped in runtime layers, primarily to reduce the container CVE surface (pip/tooling + stale base layers) while keeping Airflow 3.2.2 compatibility.
Changes:
- Bump ingestion image bases to Python 3.12 (
python:3.12-slim-bookworm/apache/airflow:3.2.2-python3.12) and fix the Airflow constraints URL to theconstraints-3.12.txtvariant. - Refresh interpreter-level pip before dropping privileges, and remove codegen-only tooling (
datamodel-code-generator,black) from CI images. - Regenerate/update
ingestion/airflow-constraints-3.2.2.txtto the Python 3.12 sibling set.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ingestion/operators/docker/Dockerfile.ci | Base bump to Python 3.12, pre-user pip pinning, and CI-only uninstall of codegen tooling. |
| ingestion/operators/docker/Dockerfile | Base bump to Python 3.12 and pre-user pip pinning. |
| ingestion/Dockerfile.ci | Airflow base bump to Python 3.12, interpreter-level pip pin, and CI-only uninstall of codegen tooling. |
| ingestion/Dockerfile | Airflow base bump to Python 3.12, interpreter-level pip pin, and fix managed-apis Airflow constraints URL to 3.12. |
| ingestion/airflow-constraints-3.2.2.txt | Updated constraints content/header for the Python 3.12-generated set. |
Suppressed comments (2)
ingestion/Dockerfile:101
- This adds a root-level pin to pip==26.2, but later the image still runs
pip install --upgrade pip "setuptools<81"as the airflow user, which will pull an unpinned pip version and makes the build non-reproducible (and could reintroduce pip CVEs in the user site-packages). Pin pip there as well to match the intent of this change.
# The explicit interpreter path is required, not stylistic: as root, `pip` resolves to
# airflow's /root/bin/pip wrapper, which exits 1 (and for non-root execs ~/.local/bin/pip),
# and bare `python` resolves to /home/airflow/.local/bin/python. Both would miss the very
# copy this line exists to fix.
RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade "pip==26.2"
ingestion/Dockerfile.ci:107
- This pins interpreter-level pip to 26.2, but the Dockerfile later runs
pip install --upgrade pip "setuptools<81"as the airflow user. That pulls an unpinned pip version and undermines reproducibility (and can reintroduce pip CVEs via the user site-packages). Pin pip there as well.
# The explicit interpreter path is required, not stylistic: as root, `pip` resolves to
# airflow's /root/bin/pip wrapper, which exits 1 (and for non-root execs ~/.local/bin/pip),
# and bare `python` resolves to /home/airflow/.local/bin/python. Both would miss the very
# copy this line exists to fix.
RUN /usr/local/bin/python -m pip install --no-cache-dir --upgrade "pip==26.2"
✅ Playwright Results — workflow succeededValidated commit ✅ 610 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 52m 29s ⏱️ Max setup 3m 23s · max shard execution 18m 35s · max shard-job elapsed before upload 21m 46s · reporting 5s 🌐 209.33 requests/attempt · 2.75 app boots/UI scenario · 12.56% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…mages
Drop the datamodel-code-generator/black uninstall from the two CI images. It
cleared no scanner findings: ECR/Inspector reads Requires-Dist out of
dist-info/METADATA without evaluating environment markers, so the
`; extra == 'dev'` declaration in openmetadata_ingestion's metadata is reported
whether or not the package is installed -- and the prod Dockerfiles never
installed it to begin with. The black findings it also targeted came from
spaCy's tests/package/requirements.txt fixture, already deleted by
patch_pyspark_jars.sh. Removing the pin from the declared dev extra is tracked
separately.
Pin the post-USER pip install to 26.2 in all four Dockerfiles, not just the two
that were flagged. An unpinned `--upgrade pip` makes the image a moving target;
with both pins matching, the user-scope install is already satisfied and writes
nothing to ~/.local, leaving a single pip on disk.
Complete the CVE comment in the two airflow Dockerfiles ("-- 26.1.2" ->
"-- fixed in 26.1.2") to match the phrasing already used in operators/docker,
and reword the comment above the root-stage pin so it no longer quotes the old
command text.
@gitar-bot , Thanks for the review Inspector doesn't report these from installed packages — it reads Requires-Dist out of dist-info/METADATA without evaluating environment markers. Requires-Dist: datamodel-code-generator ==0.25.6 ; extra == 'dev' (line 591 of the published openmetadata_ingestion wheel) is counted whether or not anything installs it. The control case is apache-airflow: slim is built as filter_requirements({"airflow", …}) so it cannot be installed in that image at any commit, yet CVE-2026-48891 is still reported against it. No pip uninstall reaches a declaration. On the published images specifically: only the .ci Dockerfiles install datamodel-code-generator. The prod operators/docker/Dockerfile installs the prebuilt wheel and never had it — verified at both the previous release commit and PR HEAD — so nothing is reintroduced there. black is a separate story: dcg declares black>=19.10b0, so the installed version resolves to 26.5.1, past the fixes for all three CVEs (24.3.0 and 26.3.1). Those findings came from spaCy's tests/package/requirements.txt pinning black==22.3.0, which patch_pyspark_jars.sh deletes — and they're already absent from the latest scan, with installed black untouched. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
ingestion/Dockerfile:3
- The Airflow integration-test fixtures still hardcode the Python 3.10 Airflow base image (e.g., ingestion/tests/integration/airflow/Dockerfile and AIRFLOW_BASE_IMAGE in conftest.py). With the production/CI ingestion images moving to python3.12, the integration tests will no longer validate the same base/runtime, which risks regressions going undetected.
FROM apache/airflow:3.2.2-python3.12
@gitar-bot , addressed the comment here: #30911 (comment) |
…exactly Pin becomes "pip>=26.2,<27" on both the root-stage and post-USER installs in all four ingestion Dockerfiles. The floor still clears CVE-2025-8869, CVE-2026-3219, CVE-2026-6357 and CVE-2026-8643 (fixed in 26.1.2); the ceiling keeps a major bump out of the image. Every pip CVE so far has been fixed within a minor line, so an exact pin would need a follow-up PR each time one lands.
🚦 Removed from the merge queue —
|
…generator 0.64.0 New call sites merged from main violate the stricter generated models: DataModel.columns is required so get_column_info's None is invalid (and would fail pydantic at runtime), Column.name is ColumnName, and Task.description is Markdown | None. Verified against basedpyright 1.39.3: the two superset errors reproduce at the exact CI positions before the change and are gone after. The airflow one is unverifiable locally (apache-airflow not installed). Co-Authored-By: Claude Opus 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (1)
ingestion/tests/integration/data_quality/test_data_quality.py:58
- Typo in variable name
test_difinitions_glob("difinitions") makes the test harder to read and grep. Since this hunk was already touched, consider renaming it totest_definitions_globand updating the loop variable accordingly.
test_definition_path = cwd.parents[3] / "openmetadata-service/src/main/resources/json/data/tests"
test_difinitions_glob = test_definition_path.glob("*.json")
test_definitions_names: list[str] = []
for test_definition_file in test_difinitions_glob:
|
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsBumps the ingestion Dockerfiles to Python 3.12 and pins pip to 26.2 to resolve base layer vulnerabilities. Consider whether to re-add the cleanup step for CVE-carrying codegen tools in the CI images. 💡 Security: CVE-carrying codegen tools no longer removed from .ci images📄 ingestion/Dockerfile.ci:135-138 📄 ingestion/Dockerfile.ci:182-185 📄 ingestion/operators/docker/Dockerfile.ci:141-143 📄 ingestion/operators/docker/Dockerfile.ci:157-160 This commit deletes the ✅ 1 resolved✅ Edge Case: Regenerated constraints pin setuptools==82.0.1, conflicting with <81 invariant
🤖 Prompt for agentsOptionsDisplay: verbose → Showing more information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |



Describe your changes:
Follow-up to #30751. That PR patched PySpark's vulnerable jars in place; this one
addresses the frozen base layer underneath them and the build toolchain.
python:3.10-slim-bookwormis EOL and no longer rebuilt, so its Debian layer and bundledPython tooling are frozen. All four ingestion Dockerfiles move to
python:3.12-slim-bookworm/apache/airflow:3.2.2-python3.12.Key changes
Base bump to Python 3.12 across
ingestion/Dockerfile{,.ci}andingestion/operators/docker/Dockerfile{,.ci}. 3.12'sensurepipships pip only — nosetuptools, no wheel — which drops the vendored
wheel-0.45.1behind CVE-2026-24049.datamodel-code-generator0.25.6 → 0.64.0 — clears 8 HIGH (CVE-2026-54621, -54653,-54654, -54690, -54691, -55389, -55391, -55415). This was a real API migration, not a
version bump; see below.
Bug fix:
ingestion/Dockerfilepinned the Airflow Python 3.10 constraints filewhile building on a python3.12 base → now
constraints-3.12.txt.Regenerated
airflow-constraints-3.2.2.txtfrom upstream's 3.12 variant. Both filescome from the same 2026-05-26 generation run, so this is the matching sibling: it drops
the
py<3.11backports (backports.strenum,exceptiongroup,tomli) and refreshesnumpy/scipy/scikit-learn. The vendored file is byte-identical to upstream — verifiable
with a single
diff.pip pinned to
>=26.2,<27on both sides of theUSERswitch. The pre-existingpip install --upgrade pipran after that switch, so it only reached~/.localandleft the base image's copy on disk for scanners (CVE-2025-8869, CVE-2026-3219,
CVE-2026-6357, CVE-2026-8643 — all fixed by 26.1.2). Python 3.12 alone is not enough:
its bundled pip is 25.0.1. The
<27ceiling keeps a major bump out while letting 26.xpatch releases in, since every pip CVE so far has been fixed within a minor line.
Type of change:
High-level design:
The
datamodel-code-generatormigration.datamodel_code_generator.model.pydanticheld the Pydantic v1 models and was removed upstream in 0.60+, so the
IMPORT_SECRET_STRpatch that swaps
pydantic.SecretStrfor ourCustomSecretStrmoves tomodel.pydantic_v2. Same mechanism — a module global resolved at call time bytype_map_factory— and we already generate with--output-model-type pydantic_v2.BaseModel, so the patched map is the one actually consulted. Verified: 125generated files carry
CustomSecretStr, identical to 0.25.6, with no rawpydantic.SecretStrleaking through. All four post-processing steps hit the same anchorsas before — the
(?U)unicode-flag rewrite, theUnionimport injection intoapp.py,the 6 stripped
(?!::)lookaheads, and theAwareDatetime→datetimesubstitution inbasic.py— andEntityName('a::b')still constructs, so the FQN encode/decode contractin
transform_entity_namesis intact.The bump also fixes 10 modules that fail to import today under pydantic 2.11:
RootModeldoes not support
model_config['extra'](eventBasedEntityTrigger,periodicBatchEntityTrigger,resolveTask,createWorkflowDefinition), plus aname-shadowing bug that left
lifeCyclebound to None in 6 entity/ai modules. 0.64.0 dropsextrafrom RootModels and disambiguates via import aliases; the full tree now imports1048/1048, up from 1038/1048. The
builders.pychange follows from$ref'd schemadefaults now being honored.
Why the airflow images need
/usr/local/bin/python -m piprather than plainpip:three independent reasons, all verified in the base image —
pipresolves to airflow's/root/bin/pipwrapper, whichexit 1s (so aplain
pipline fails the build, it doesn't silently no-op);execs${HOME}/.local/bin/pipeven for non-root, so it can never reachthe interpreter-level install;
pythonas root resolves to/home/airflow/.local/bin/python, sopython -m pipalso targets
~/.local.Only
/usr/local/bin/python(→/usr/python/bin/python3) reaches the copy scannersreport. The slim images are ordinary
python:3.12-slim-bookwormwith no wrapper, so plainpipis correct there.Alternative rejected — lifting
setuptools<81. setuptools ≥83 fixes CVE-2026-59890,but ≥81 deprecates and ≥83 removes
pkg_resources, andsqlalchemy_redshift/__init__.py:1imports it unguarded at module top level, with
sqlalchemy-redshift==0.8.14(2023) beingthe final release. Worth noting the CVE is an sdist
MANIFEST.inexclusion bypass viaUnicode normalization collision on macOS APFS/HFS+ — no reachable path in a Linux
runtime image that never builds sdists. Left as a documented residual.
Rollout / compatibility.
cx_Oracle 8.3.0andmysqlclient==2.1.1have no cp312 wheelbut both build cleanly from sdist on 3.12 (the toolchain and
pkg-configare alreadyinstalled) — verified in a container. Bumping
mysqlclientto 2.2.x for a prebuilt wheelis a sensible follow-up but is not required here.
Note on how ECR/Inspector reports these
Inspector reads
Requires-Distout of installeddist-info/METADATAwithout evaluatingenvironment markers, so a
; extra == 'dev'declaration is reported as a dependency ofan installed package even when nothing installs it. That is why the
datamodel-code-generatorfindings are fixed by bumping the declared pin rather thanby removing the package: an earlier revision of this PR ran
pip uninstallin the two CIimages, which cleared nothing, and has been dropped.
Tests:
Use cases covered
openmetadata-managed-apisunder the matching 3.12constraints file.
CustomSecretStrsurface on 0.64.0.Unit tests
is verified by full-tree import and diff against 0.25.6 output (below) rather than by new
tests.
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
docker buildx build --checkclean on all four Dockerfiles.pip install --upgrade pipas root inapache/airflow:3.2.2-python3.12exits1, and that
/usr/local/bin/python -m pip install "pip>=26.2,<27"exits 0 and landsin
/usr/python/lib/python3.12/site-packages.openmetadata-airflow-apisunder the regenerated constraints file in the 3.12airflow base — succeeds, setuptools stays at the pinned 80.10.2, and
pkg_resourcesstill imports.
cx_Oracle 8.3.0andmysqlclient==2.1.1build from sdist onpython:3.12-slim-bookworm.CustomSecretStr(identicalto 0.25.6), no raw
pydantic.SecretStrleaks, and 1048/1048 modules import.pip is 26.2 and the only copy on disk;
/usr/local/lib/python3.12/site-packagescarriesno setuptools or wheel (the only wheel left is
setuptools/_vendor/wheel-0.46.3, pastthe 0.45.1 that carried CVE-2026-24049);
openjdk-17-jre-headlessresolves to the fixed17.0.20+8-1~deb12u1.