Repository navigation
fix(security): apply Debian security updates and drop pip from runtime image - #2670
Draft
groupthinking wants to merge 2 commits into
Draft
groupthinking wants to merge 2 commits into
groupthinking wants to merge 2 commits into
Conversation
The runtime stage builds on python:3.11-slim, whose base layer predates DSA-6613-1. Security run 43343802638 (artifact 14000154856, image sha256:99a1cbcd...) reports zlib1g 1:1.3.dfsg+really1.3.1-1+b1 with CVE-2026-76844 and CVE-2026-85091 (HIGH), both fixed in trixie-security 1:1.3.dfsg+really1.3.1-1+deb13u1; the build log shows '1 not upgraded'. Run apt-get upgrade before installing runtime packages and lock the ordering with a policy test. Refs #2396
pip 26.3 (newest on PyPI) ships pip/_vendor/bom.cdx.json declaring its vendored pkg_resources as setuptools 70.3.0. Security run 43343802638 (artifact 14000154856) reports CVE-2025-47273 (HIGH, fixed 78.1.1) against that record, and no pip release clears it yet. The served app (uvicorn) never invokes pip; only the developer-only 'youtube-extension install' CLI shells out to it. Uninstall pip after the builder environment is copied, and lock the placement with a policy test. Refs #2396
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This branch was successfully deployed
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.
fix(security): clear the fixable runtime-image findings (zlib1g, pip-vendored setuptools)
Refs #2396 (partial; parent stays open). Linear: GRV-807.
Baseline evidence
mainat512a2558f73d6281b6a880548bedf140b7e30292(PR fix(security): refresh runtime npm's bundled undici #2645 merge).trivyjob 131618182805 concluded success because the job usesexit-code: '0'.trivy-image-evidence14000154856, ZIP SHA-256631a3072ccdc7a0a3591b53deecc58cda06773627d0458c69c97c1a866cffdfc.image-source-commit.txt=512a2558f…. Image IDsha256:99a1cbcdbe9294c508649c5dea491e20242937d9374e774c3ae37bb02992eaa5(local build, linux/amd64). Basepython:3.11-slim@sha256:07d4824036af339fa1b6ef769cc99d9c10a141769538b52b3b597c84f7a7b535(Debian 13 trixie). Trivy 0.70.0.The global npm (brace-expansion, http-cache-semantics, undici) and pip-vendored msgpack/urllib3 findings from the October baseline are absent from this report.
Changes (two commits, separately revertible)
apt-get upgradein the runtime stage before installing runtime packages. The base layer shipszlib1g 1:1.3.dfsg+really1.3.1-1+b1; the Debian tracker lists both CVEs fixed in trixie-security1:1.3.dfsg+really1.3.1-1+deb13u1(DSA-6613-1). The.debis present in the security.debian.org pool. The build log already shows1 not upgraded.dist-upgrade. The image is still not reproducible to the byte, because upgrades follow the archive on the day it builds; that was already true of the unpinnedapt-get installlines.pip uninstall --yes pipin the runtime stage afterCOPY --from=builder /usr/local/bin. pip 26.3 (newest on PyPI, wheel sha256f3b60b20…fad13) shipspip/_vendor/bom.cdx.jsondeclaringsetuptools 70.3.0(its vendoredpkg_resources). That record is the CVE-2025-47273 hit; site-packages setuptools is already 84.2.1. No pip upgrade clears it.uvicorn youtube_extension.main:app) does not import or invoke pip. Only the developer CLIyoutube-extension installshells out topython -m pip, and that is not a runtime path in this image. Anyone debugging in a running container can no longerpip install(usepython -m ensurepipif needed).pip*scripts andbom.cdx.json, and the interpreter still runs.Policy tests were added to
tests/unit/test_merge_policy_security_scan_wording.py: upgrade precedes install with nodist-upgrade, and pip is removed after the builder copy, beforeUSER, with no laterpip install. Each new test fails against512a2558and passes with its change.Expected effect: UNVERIFIED until this PR's Trivy run
316 → 313 expected (−2 zlib1g, −1 setuptools), leaving no finding with a reported fix. Not a clean image: 313 Debian occurrences with no fixed version remain. Main groups: ffmpeg/libav* 153, krb5 56, util-linux 36, Debian python3.13 pulled by nodesource
nodejs20, gnupg 7, curl 4, libxml2 8 (one CRITICAL), others 29.Verification
pytest -o addopts="" tests/unit/test_merge_policy_security_scan_wording.py tests/unit/test_node_engines_floor.py tests/unit/test_dependency_review_workflow.py: 89 passed.ruff check/ruff format --checkon the changed test file: clean.git diff --check: clean.Not in scope (follow-ups)
ignore-unfixed: true+exit-code: '1'for fixable HIGH/CRITICAL in one scan step, keeping the full SARIF step atexit-code: '0'. This needs MERGE_POLICY.md and policy-test updates, and it would be green only after this PR lands.ffmpegalone accounts for 153 occurrences.gnupg/curlare only needed at build time for the nodesource script and could move out of runtime via a Node binary copy or keyring.python3.13comes in as a nodesourcenodejsdependency.