Skip to content

Commit f21d482

Browse files
Sheeproidclaude
andauthored
ROB-1636 Bump urllib3 to 2.8.0 and drop pip from the image to fix CVEs (#556)
## Summary - **urllib3** 2.7.0 → 2.8.0 in `pyproject.toml`, `poetry.lock`, `requirements.txt` and `enforcer/requirements.txt`. Fixes CVE-2026-97687 and CVE-2026-97689 (High). Closes dependabot alerts #122, #123, #125, #126, #128 and #129, and the matching Artifact Registry findings on `devel/krr`. - **Dockerfile**: pip is uninstalled once the requirements are installed. pip 26.2.1, the latest release, vendors its own urllib3 2.7.0, so the dependency bump alone left the CVEs in the image. krr never calls pip at runtime. The pip upgrade, requirements install and uninstall run in one `RUN`, so the upgraded pip never lands in an image layer (CodeRabbit's finding, now fixed). Linear: [ROB-1636](https://linear.app/robusta/issue/ROB-1636) ## Verification - `poetry lock --no-update` with Poetry 1.8.5: only urllib3 changes in the lock. `poetry check --lock` passes. - `pytest`: 55 passed. - Built the image for `linux/amd64` and scanned it with Trivy (Docker Scout isn't available in the sandbox). The Python packages have no HIGH or CRITICAL findings. Before this change the image showed urllib3 2.7.0 (pip's vendored copy) and msgpack 1.1.2. `docker history` shows no separate pip layer. - Built for `linux/arm64` under QEMU (from the commit before the single-`RUN` change, so the same packages): it runs on `aarch64`, Trivy reports the same results as amd64, urllib3 is 2.8.0, and pip is gone. - In both images `krr.py simple --help` works. - Not tested: a rescan in Artifact Registry. The Vanta finding clears only after CI publishes the image. Out of scope: - `gcc-14` CVE-2026-95619 (Low, no Debian fix) and 10 unfixed Debian HIGHs, unchanged from `main`. - The `enforcer` image installs pip the same way, but Vanta has not flagged it. - The enforcer README's "Python 3.9+" was already wrong before this PR. It's tracked in [ROB-1650](https://linear.app/robusta/issue/ROB-1650). --- _Generated by [Claude Code](https://claude.ai/code/session_01Fq7hqRqj2kshg8M2sFpN7h)_ --------- Signed-off-by: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8b4e9e3 commit f21d482

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

‎Dockerfile‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ WORKDIR /app
1919

2020
COPY ./requirements.txt requirements.txt
2121

22-
RUN pip install --no-cache-dir --upgrade pip
23-
# Install the project dependencies
24-
RUN python -m ensurepip --upgrade
25-
# Bundled pip 25.0.1 wheel carries CVE-2025-8869, CVE-2026-3219/6357/8643
26-
RUN rm -f /usr/local/lib/python3.12/ensurepip/_bundled/pip-*.whl
27-
RUN pip install --no-cache-dir -r requirements.txt
22+
# Install the project dependencies, then drop pip: 26.2.1 (latest) vendors
23+
# urllib3 2.7.0 (CVE-2026-97687, CVE-2026-97689) and krr never calls pip at
24+
# runtime. One RUN so the upgraded pip never lands in an image layer.
25+
# The bundled pip 25.0.1 wheel carries CVE-2025-8869, CVE-2026-3219/6357/8643.
26+
RUN pip install --no-cache-dir --upgrade pip \
27+
&& python -m ensurepip --upgrade \
28+
&& rm -f /usr/local/lib/python3.12/ensurepip/_bundled/pip-*.whl \
29+
&& pip install --no-cache-dir -r requirements.txt \
30+
&& pip uninstall -y pip
2831

2932
# Copy the rest of the application code
3033
COPY ./krr.py krr.py

‎enforcer/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ prometheus-client==0.20.0
99
python-json-logger==3.3.0
1010
kubernetes==26.1.0
1111
pyasn1>=0.6.2
12-
urllib3==2.7.0
12+
urllib3==2.8.0

‎poetry.lock‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pyyaml = "6.0.1"
3838
# pytest-asyncio >=1.3 (needed for pytest 9 / CVE-2025-71176) requires typing-extensions >=4.12
3939
typing-extensions = ">=4.12.0,<5"
4040
idna = "3.15"
41-
urllib3 = "^2.7.0"
41+
urllib3 = "^2.8.0"
4242
setuptools = "^83.0.0"
4343
# transitive deps pinned for CVE fixes
4444
pillow = "^12.3.0"

‎requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typer==0.7.0 ; python_version >= "3.10" and python_full_version < "3.13"
5151
typing-extensions==4.16.0 ; python_version >= "3.10" and python_full_version < "3.13"
5252
tzdata==2024.1 ; python_version >= "3.10" and python_full_version < "3.13"
5353
tzlocal==5.2 ; python_version >= "3.10" and python_full_version < "3.13"
54-
urllib3==2.7.0 ; python_version >= "3.10" and python_full_version < "3.13"
54+
urllib3==2.8.0 ; python_version >= "3.10" and python_full_version < "3.13"
5555
websocket-client==1.7.0 ; python_version >= "3.10" and python_full_version < "3.13"
5656
zipp==3.20.2 ; python_version >= "3.10" and python_full_version < "3.13"
5757
# required for tests

0 commit comments

Comments
 (0)