Skip to content

Commit 62aebd9

Browse files
mprahlopenshift-merge-bot[bot]
authored andcommitted
keep: Fix CVE-2026-48710 in ODH shipped dependencies
Override the Konflux PyPI wheelhouse to install a fixed Starlette release in the final runtime image, omit direct packages listed in `requirements/konflux-pypi.in` from the final AIPCC lockfile, add explicit cross-arch AIPCC pins where the index resolves different versions per architecture, and include `hatchling` in the Konflux build-only dependencies so Starlette sdist builds succeed in the hermetic builder. Signed-off-by: mprahl <mprahl@users.noreply.github.com>
1 parent 05ebb66 commit 62aebd9

9 files changed

Lines changed: 144 additions & 109 deletions

Dockerfile.konflux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ RUN set -eux; \
5858
/tmp/dist/mlflow-*.whl \
5959
/tmp/dist/mlflow_kubernetes_plugins-*.whl \
6060
/tmp/dist/prometheus_flask_exporter-*.whl \
61-
/tmp/dist/psycopg2-*.whl && \
61+
/tmp/dist/psycopg2-*.whl \
62+
/tmp/dist/starlette-*.whl && \
6263
microdnf clean all && \
6364
rm -rf /tmp/dist /tmp/konflux-aipcc-requirements.txt
6465

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ docs = [
239239

240240
[tool.uv]
241241
exclude-newer = "P14D"
242-
exclude-newer-package = { torch = false, torchvision = false, mlflow-kubernetes-plugins = false }
242+
exclude-newer-package = { torch = false, torchvision = false, mlflow-kubernetes-plugins = false, starlette = false }
243243
required-version = ">=0.10.12"
244244
constraint-dependencies = [
245245
# xgboost 3.1.0 changed base_score format to vector for multi-output models, breaking shap compatibility

requirements/compile.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
33
For AIPCC requirements (konflux-aipcc, konflux-build-aipcc), runs uv pip compile
44
inside Docker containers for each target architecture, then merges the
5-
per-architecture hashes into a single output file.
5+
per-architecture hashes into a single output file. Packages explicitly listed
6+
in requirements/konflux-pypi.in are omitted from the final-image AIPCC output
7+
so SBOM and CVE tooling see a single source of truth per shipped package.
68
79
For PyPI requirements (konflux-pypi), runs a single uv pip compile since these
810
packages are built from source and don't need multi-arch hashes.
@@ -20,6 +22,7 @@
2022
import tempfile
2123
from concurrent.futures import ThreadPoolExecutor, as_completed
2224
from dataclasses import dataclass, field
25+
from functools import cache
2326
from pathlib import Path
2427
from typing import Any
2528

@@ -41,6 +44,7 @@
4144
}
4245

4346
REPO_ROOT = Path(__file__).resolve().parent.parent
47+
KONFLUX_PYPI_IN = REPO_ROOT / "requirements/konflux-pypi.in"
4448

4549

4650
@dataclass
@@ -92,6 +96,14 @@ def _canonicalize(name: str) -> str:
9296
return re.sub(r"[-_.]+", "-", name).lower()
9397

9498

99+
@cache
100+
def read_requirements_names(path: Path) -> frozenset[str]:
101+
session = PipSession()
102+
return frozenset(
103+
_canonicalize(ireq.req.name) for ireq in parse_requirements(str(path), session=session)
104+
)
105+
106+
95107
def run_uv_compile_in_docker(
96108
target: CompileTarget,
97109
arch: str,
@@ -204,7 +216,10 @@ def parse_and_collect_hashes(
204216
detail = ", ".join(f"{a}: {v}" for a, v in sorted(arch_versions.items()))
205217
raise SystemExit(
206218
f"Version mismatch for {name}: {detail}. "
207-
"All architectures must resolve to the same version."
219+
"All architectures must resolve to the same version. "
220+
"Add an explicit constraint for this package to the relevant "
221+
"AIPCC input file (for example `requirements/konflux-aipcc.in`) "
222+
"and rerun `python requirements/compile.py`."
208223
)
209224

210225
return canonical_ireqs, merged_hashes
@@ -214,6 +229,7 @@ def write_multiarch_output(
214229
target: CompileTarget,
215230
canonical_ireqs: dict[str, Any],
216231
merged_hashes: dict[str, set[str]],
232+
excluded_names: set[str] | None = None,
217233
) -> None:
218234
out_path = REPO_ROOT / target.out_file
219235
parts: list[str] = []
@@ -232,6 +248,8 @@ def write_multiarch_output(
232248
parts.append(f"--index-url {target.index_url}\n\n")
233249

234250
for name in sorted(canonical_ireqs):
251+
if excluded_names and name in excluded_names:
252+
continue
235253
ireq = canonical_ireqs[name]
236254
hashes = merged_hashes[name]
237255
parts.append(format_requirement(ireq, hashes=hashes) + "\n")
@@ -289,7 +307,12 @@ def compile_multiarch(target: CompileTarget, image: str) -> None:
289307

290308
canonical_ireqs, merged_hashes = parse_and_collect_hashes(arch_outputs)
291309

292-
write_multiarch_output(target, canonical_ireqs, merged_hashes)
310+
excluded_names = (
311+
read_requirements_names(KONFLUX_PYPI_IN) if target.name == "konflux-aipcc" else None
312+
)
313+
write_multiarch_output(
314+
target, canonical_ireqs, merged_hashes, excluded_names=excluded_names
315+
)
293316
finally:
294317
for arch_tag in arch_images.values():
295318
subprocess.run(["docker", "rmi", arch_tag], capture_output=True)

requirements/konflux-aipcc-requirements.txt

Lines changed: 90 additions & 97 deletions
Large diffs are not rendered by default.

requirements/konflux-aipcc.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ prometheus-client
1919

2020
# Cross-arch constraints: pin packages to versions available on all target
2121
# architectures (aarch64, ppc64le, x86_64) on the AIPCC index.
22+
matplotlib==3.10.8
2223
pyarrow<23.0.1
2324
litellm<2,>=1.0.0
25+
pydantic==2.13.1
26+
tokenizers==0.22.2

requirements/konflux-build-aipcc-requirements.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@
66
#
77
--index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4/cpu-ubi9/simple
88

9-
build==1.4.2 \
10-
--hash=sha256:ef5814e19f805164dd8c5111bd7015bf17da172017ef4a1101f9a1b82cd8b15e
11-
packaging==26.0 \
12-
--hash=sha256:3d88de7604ff5eef52df30fd9803c8cf1565e6da3bd3c8c3f4e7d7f18c11069c
9+
build==1.5.0 \
10+
--hash=sha256:7f948e63f9f6094d01ea6b9354b226d8bf8e7c9b2d56d5f21b904c6a236cc985
11+
hatchling==1.29.0 \
12+
--hash=sha256:9a3792b32617f6e19cff11058e2f2fcf3befcb7220c7cbafccd9eecee1a74c73
13+
packaging==26.2 \
14+
--hash=sha256:31c96589d316a65625213114e0a1c9707c47a620bf0e89c19e6c062c946a760f
15+
pathspec==1.1.1 \
16+
--hash=sha256:19f453436f4bb6c9de7c6b67127dc34afd9f65a9828ad50c36b0417ffbce05bc
17+
pluggy==1.6.0 \
18+
--hash=sha256:984df28329611bee51530a6c39a6b3267a07abc257ea752a83b40146e1923b87
1319
pyproject-hooks==1.2.0 \
1420
--hash=sha256:23f914be06e835a1cac214a3c08daffbdf4d33f685194c76b38b079d8cf1dc62
1521
setuptools==80.10.2 \
1622
--hash=sha256:05ef2ee3d34409715c7d0589a3a0c6064a2b117f8489a5b512aef078173d1faf
17-
wheel==0.46.3 \
18-
--hash=sha256:70ed432fbcd9b7d938edc4be7ac57478e1f48a6b165494deb7e6e1c81a34a15c
23+
trove-classifiers==2026.4.28.13 \
24+
--hash=sha256:dfb9cb476ea0705e542127c2d995a76942f8410f55d2b93aaa27d161950fda32
25+
wheel==0.47.0 \
26+
--hash=sha256:8593705d08f649098548a620edff8cceee09e57cb953f78a94c1aa3b9c051704

requirements/konflux-build-aipcc.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
# python requirements/compile.py
77

88
build
9+
hatchling
910
setuptools
1011
wheel

requirements/konflux-pypi-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ psycopg2==2.9.11 \
1818
--hash=sha256:e03e4a6dbe87ff81540b434f2e5dc2bddad10296db5eea7bdc995bf5f4162938 \
1919
--hash=sha256:f10a48acba5fe6e312b891f290b4d2ca595fc9a06850fe53320beac353575578
2020
# via -r requirements/konflux-pypi.in
21+
starlette==1.2.0 \
22+
--hash=sha256:36e0c76ac59157e75dc4b3bdeafba97fb04eaf1878045f15dbef666a6f092ed7 \
23+
--hash=sha256:3c5a6b23fff42492914e93890bb80cbfea72dbf37de268eec06185d62a4ca553
24+
# via -r requirements/konflux-pypi.in

requirements/konflux-pypi.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# hermetically by Cachi2 during the Konflux pipeline.
44
#
55
# All transitive dependencies of these packages are already satisfied by
6-
# the AIPCC Python package index (requirements/konflux-aipcc-requirements.txt), so only these two
6+
# the AIPCC Python package index (requirements/konflux-aipcc-requirements.txt), so only these
77
# packages themselves need to be listed here.
88
#
99
# To regenerate the lock file (requirements/konflux-pypi-requirements.txt), run:
@@ -13,3 +13,5 @@
1313
mlflow-kubernetes-plugins==1.2.1
1414
psycopg2
1515
prometheus-flask-exporter
16+
# Starlette 1.0.1+ is not yet available on the rhoai/3.4 AIPCC index.
17+
starlette>=1.0.1,<2

0 commit comments

Comments
 (0)