Repository navigation
chore(security): move Docker image off EOL python:3.9 bullseye base - #290
Open
dex-the-ai wants to merge 2 commits into
Open
dex-the-ai wants to merge 2 commits into
dex-the-ai wants to merge 2 commits into
Conversation
python:3.9-slim-bullseye is end-of-life (Python 3.9 EOL 2025-10, Debian 11 EOSL) and Trivy reports 7 CRITICAL / 164 HIGH OS CVEs in it. It also no longer builds: fastapi==0.162.0 requires Python >=3.10. Switch to python:3.13-slim (Debian 13) and copy hotel_search_index.json into the image so the app can create the hotel_search FTS index at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The monthly security audit (Kanban
t_3fb366b2, boardcouchbase-examples) found that the Python dependencies are clean. The Docker image is the problem:Dockerfileusespython:3.9-slim-bullseye. Python 3.9 reached end of life in October 2025, and Debian 11 is past end of support (Trivy marks itEOSL: true). Trivy reports 7 CRITICAL and 164 HIGH OS CVEs in that base image, and many of them will never get a Debian fix.fastapi==0.162.0requires Python ≥3.10, sodocker buildfails atpip installonmaintoday.hotel_search_index.json. The app therefore loggedNo such file or directory: 'hotel_search_index.json'and could not create thehotel_searchFTS index, so the hotel search/autocomplete endpoints returned 500.This PR makes three changes:
FROM python:3.9-slim-bullseye→FROM python:3.13-slim(Debian 13 "trixie").hotel_search_index.jsoninto the image.requirements.txtis unchanged. Python 3.13 is the newest version that couchbase 4.6.4 and all the other pins install on.Advisories
Why it matters: anyone who follows the README's "Using Docker" path gets a broken build. Even after a fix to the build, the image would sit on an unsupported OS that will never receive patches for these CRITICAL CVEs in TLS (gnutls), compression (zlib) and perl.
Python packages:
pip-audit -r requirements.txtfound nothing. Inside the built image,pip-auditandpip freezeshow anyio 4.16.0, certifi 2026.11.20 and idna 3.20, all clean.osv-scannerflagged anyio 4.9.0 (GHSA-82r6-8w77-94w6, CRITICAL), certifi 2026.7.22 (GHSA-6q48-6c7w-9gw2, CRITICAL) and idna 3.9.0, but those versions came from osv-scanner's own transitive resolver. pip installs the fixed versions, so these are not real exposures. ThecouchbasePYSEC-2023-235 hit is the known OSV false positive for the server CVE-2023-45875.Before / after (Trivy HIGH,CRITICAL)
python:3.9-slim-bullseye(main)python:3.13-slim)Residual: the 5 Python HIGH findings are msgpack/urllib3 vendored inside pip 26.2.2 (the latest pip) plus a setuptools copy in the base image. They are image tooling and the app does not import them at runtime. They will clear as upstream pip and python images update.
Validation
docker buildonmain: fails (No matching distribution found for fastapi==0.162.0, Requires-Python >=3.10)docker buildon this branch: succeedshotel_searchFTS index was created at startup (917 docs indexed).python -m pytestrun inside the built image against the running app container: 54 passed (with the old COPY layout, the 8 hotel tests failed with 500 because the index JSON was missing)/docsand liveGET /api/v1/hotel/autocomplete?name=sea→ 200:Commands:
CI (
tests.yml) runs on the runner's system Python and does not use the Dockerfile, so it is unaffected by this change.Risk / rollback
Kanban task:
t_3fb366b2(boardcouchbase-examples, idempotency keycouchbase-security-review-monthly:couchbase-examples/python-quickstart-fastapi:2026-11)🤖 Generated with Claude Code