Repository navigation
fix(image): upgrade vulnerable Python packages - #441
Conversation
The Python 3.11 and 3.12 base images ship pip 24.0 and 25.0.1, with known vulnerabilities (CVE-2025-8869, CVE-2026-1703, CVE-2026-3219, CVE-2026-6357, CVE-2026-8643, CVE-2026-13346; fixed by 26.2). pip stays in the image, as images built from FOCA's install their packages with it, so upgrade it to the latest release, as the 3.13 and 3.14 images already ship. Note the change in the migration guide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pip 26.2.2, the latest release, vendors setuptools 70.3.0 (only pkg_resources) and urllib3 2.7.0, which Trivy reports with CVE-2026-59890 and CVE-2026-97688 (medium). Accept them like the other findings of these copies: pip only runs at build time, and the setuptools one affects sdist builds on macOS. Correct the location of pip's SBOM (`pip/_vendor/bom.cdx.json`) in the comment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
setuptools 83 fixes CVE-2026-59890 (exclusions of MANIFEST.in bypassed in sdists), so raise the floor of the build requirement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
List the new setuptools build floor in the migration guide, explain why CVE-2026-97688 doesn't affect pip's vendored urllib3 at build time, and use one date in the comment of the vendored copies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
certifi 2026.10.18, found by cloud-registry's weekly scan in its image (built on FOCA's), still trusts the emSign root CAs whose intermediate CAs have compromised keys (GHSA-6q48-6c7w-9gw2, critical; fixed in 2026.10.19). FOCA uses certifi via requests; add a floor, so that the images and installs of FOCA never get an affected version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR hardens all FOCA Python images by upgrading pip to at least 26.2, raises setuptools and certifi floors for source builds and runtime dependencies, and narrowly documents and suppresses only the remaining vulnerabilities in pip's vendored packages. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #441 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 2869 2869
=========================================
Hits 2869 2869
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="docker/Dockerfile" line_range="25" />
<code_context>
+# upgrade it to the latest release (a no-op where the image already ships
+# that one)
+RUN pip uninstall --yes --no-cache-dir setuptools wheel && \
+ pip install --no-cache-dir --upgrade "pip>=26.2"
# Build image
</code_context>
<issue_to_address>
**Malicious index stalls builds**
When a configured package index is compromised or otherwise serves a malicious chunked-deflate response, `pip install` uses pip’s vendored urllib3 2.7.0 to fetch from the configured package index; a malicious index response triggers its infinite loop, stalling image or derived-app builds and consuming CI capacity.
Use a pip release with patched vendored urllib3 when available, or otherwise prevent vulnerable pip from processing untrusted index responses.
Also at `.trivyignore.yaml:38`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and the certifi minimum changes the CA bundle used for TLS verification, so a faulty bundle could allow a compromised certificate to pass and expose data in connections made before the image is corrected. Reverting restores the previous bundle, but it cannot undo any exposure that already occurred.
Blocking findings: docker/Dockerfile:25
Summary
Removes the fixable Python package findings from the FOCA images (all Python variants), so that apps get clean base images with 0.17.0.
docker/Dockerfileupgrades pip to the latest release (pip>=26.2; 26.2.2 today, which the 3.13 and 3.14 images already ship). pip stays in the image, because apps built on it (cloud-registry, proTES, trs-filer, the petstore examples) runpip installon top.pip/_vendor/bom.cdx.json. pip 26.2.2, the latest release, still vendors them, so upgrading can't fix them and removing pip would break the apps. They are accepted in.trivyignore.yamllike the existing (high) entries for the same copies: limited by purl, with a reason and an expiry date. pip vendors onlypkg_resourcesfrom setuptools, and doesn't use it on Python 3.11+, while the setuptools CVE concerns sdist builds on macOS. The urllib3 CVE is a hang on malicious responses, and pip only runs at build time, against the configured index. The comment now gives the real location of pip's SBOM. The installed urllib3 is 2.8.0.certifi>=2026.10.19. FOCA gets certifi through requests. The images built here have 2026.10.23, and pip's vendored copy is 2026.10.19.setuptools>=83, which fixes CVE-2026-59890 for FOCA's own sdists.Not changed: the scan gate still fails only on fixable CRITICAL/HIGH findings. Failing on MEDIUM too would have caught the pip findings, but the scan action is kept identical in FOCA, cloud-registry and proTES. So that change belongs in all three together, as a follow-up. Fixable MEDIUM findings still appear in code scanning.
Verification
docker build -f docker/Dockerfile --build-arg PY_IMAGE=<3.11|3.12|3.13|3.14>-slim-trixie). Each has pip 26.2.2, no setuptools or wheel, urllib3 2.8.0 and certifi 2026.10.23 (checked before the certifi floor, which doesn't change the resolved version).aquasec/trivy:0.75.0, vulnerability scanner) with.trivyignore.yaml: 0 fixable findings on all four variants, at any severity. Without the ignore file, the only fixable findings are the six of pip's vendored copies (msgpack 1.1.2, setuptools 70.3.0, urllib3 2.7.0), all of them accepted.pip install gunicornand a pyproject (setuptools) package install as root work.pre-commit runon the changed files passed.mkdocs build --strictpassed.pytest tests -k "not mongodb": 1714 passed (the MongoDB-backed tests need a MongoDB service and run in CI).Scan imagefor Python 3.11, 3.12, 3.13 and 3.14. The 3.11 build log shows pip 24.0 replaced by 26.2.2 and certifi 2026.10.23 installed, and Trivy reports 0 findings for both packages.Declined review findings
pyproject.toml.Closes #437
🤖 Generated with Claude Code
Summary by Sourcery
Harden FOCA's Python images and build dependencies against fixable package vulnerabilities while retaining pip support for downstream application builds.
Bug Fixes:
Enhancements:
Documentation: