Commit 8781b44
authored
fix: strip base image's system pip/setuptools tripping image-scan (#120)
image-scan has been red since 2026-08-04. Trivy flagged HIGH findings
(msgpack GHSA-6v7p-g79w-8964, setuptools CVE-2025-47273) that contradict
uv.lock, which already pins the fixed versions (msgpack 1.2.1, setuptools
82.0.1).
Confirmed H2, not H1: direct inspection of the built image showed no
scan-ref/SBOM misconfiguration in the workflow (Trivy already scans
image-ref, not a workspace SBOM). Instead python:3.14-slim ships its own
system pip whose pip/_vendor/msgpack is a separate vendored copy, plus a
bundled wheel under ensurepip/_bundled/ -- both pip-installed, so
`apt-get upgrade` never touches them. The app only runs from the isolated
/app/.venv populated from uv.lock, which never contained either package.
The runtime stage now removes the base image's ensurepip module, system
pip/setuptools/pkg_resources, and their /usr/local/bin shims -- dead
weight with no runtime purpose.
A third, real finding also surfaced during the discriminating scan:
aiohttp 3.14.1 (transitive via langchain-community) has a fixed HIGH CVE
(CVE-2026-69244) in the actual locked venv. Bumped via
`uv lock --upgrade-package aiohttp` (3.14.1 -> 3.14.3), touching only
that package in uv.lock.
Verified: docker build + trivy image --exit-code 1 --ignore-unfixed
--severity HIGH,CRITICAL now reports zero findings; container still
starts and passes its /health check.1 parent 79d26ff commit 8781b44
3 files changed
Lines changed: 115 additions & 85 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
67 | 94 | | |
68 | 95 | | |
69 | 96 | | |
| |||
0 commit comments