Skip to content

fix: accept pip's vendored urllib3/setuptools - #326

Merged
uniqueg merged 2 commits into
devfrom
fix/trivy-pip-vendored
Nov 2, 2026
Merged

uniqueg merged 2 commits into
devfrom
fix/trivy-pip-vendored

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Clears the three open Trivy code-scanning alerts on dev (target "Python"): 167 (urllib3 2.7.0, CVE-2026-97688), 166 (setuptools 70.3.0, CVE-2026-59890) and 343 (setuptools 70.3.0, GHSA-xmj3-9gf7-h52w).

Root cause: these are not installed packages but the copies vendored by pip 26.2.2 of the base image (pip/_vendor/vendor.txt, SBOM pip/_vendor/bom.cdx.json). uv.lock already installs urllib3 2.8.0, and setuptools 84.2.1 only in the build stage (the final image installs none). pip 26.2.2 is the latest release, and pip's main branch still vendors setuptools 70.3.0, so nothing can be bumped; pip only runs at build time, and nothing in site-packages imports pip or its vendored packages.

  • .trivyignore.yaml: accepts the three advisories, limited to the vendored versions (purls), with statements and the expiry 2027-01-31, as for the earlier vendored-copy advisories and identical to FOCA's entries (build: accept setuptools advisory vendored by pip foca#562). The block comment now names the actual SBOM path and today's check date.
  • docs/releases/1.0.0rc1.md: Security bullet.

Removing pip from the image, which clears all vendored findings, stays in #279 (untouched).

Closes #325

Verification

  • Built the image locally (docker build, tag cr-trivy-fix-base:local): pip list shows urllib3 2.8.0 and no setuptools; pip/_vendor/vendor.txt lists urllib3==2.7.0 and setuptools==70.3.0.
  • Trivy 0.75.0 (aquasec/trivy:0.75.0, same flags as the shared scan-image action: --ignorefile .trivyignore.yaml --ignore-unfixed): before, Python: 3 (MEDIUM 2, LOW 1: CVE-2026-59890, GHSA-xmj3-9gf7-h52w, CVE-2026-97688); after, 0 findings in all targets; the CRITICAL,HIGH gate exits 0.
  • pre-commit run --all-files (ruff, mypy, semgrep, gitleaks, actionlint, ...): passed.
  • scripts/release_notes.py check docs/releases/1.0.0rc1.md: passed.
  • coverage run -m pytest: 1603 passed, 100% coverage; the 263 chart/config tests that failed locally only because the mise helm shim had no version set pass with it set (287 passed).
  • CI (run 41366235776): all checks passed, Scan image included, CI passed green.

Declined review findings

  • Dates in the .trivyignore.yaml comment (low): they record when pip's latest release was checked, as the existing entries do.
  • Longer statement of the CVE-2026-97688 entry (low): kept identical to FOCA's entry.
  • Commit trailer model name (low): it is the attribution prescribed for this session.

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG

Summary by Sourcery

Accept pip's vendored urllib3 and setuptools advisories while distinguishing them from the application's installed dependencies.

Enhancements:

  • Document and narrowly ignore security advisories affecting urllib3 and setuptools versions vendored by pip and unused by the application.

Documentation:

  • Add release notes documenting the accepted vendored-dependency advisories and their expiration date.

uniqueg and others added 2 commits November 2, 2026 01:03
Trivy reports CVE-2026-97688 (urllib3 2.7.0), CVE-2026-59890 and
GHSA-xmj3-9gf7-h52w (setuptools 70.3.0) in the image. These are the
copies vendored by pip 26.2.2 of the base image, not installed
packages: uv.lock installs urllib3 2.8.0, and setuptools 84.2.1 only
in the build stage. pip 26.2.2 is the latest release and still
vendors these versions, so they can't be bumped; pip only runs at
build time. Accept them in .trivyignore.yaml, limited to the vendored
versions, until 2027-01-31, as for the earlier advisories and as FOCA
does. Removing pip from the image stays in #279.

Closes #325

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
Re-flow the comment of the vendored copies in .trivyignore.yaml, and
word the release-notes bullet without "more" and without claiming the
image has no setuptools at all (pip vendors its pkg_resources).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMUX3EU35poH13xMgG
@uniqueg uniqueg added this to the v1.0.0-rc1 milestone Nov 2, 2026
@uniqueg uniqueg added type: security Related to security docker labels Nov 2, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR addresses Trivy findings caused by pip 26.2.2’s build-time vendored urllib3 2.7.0 and setuptools 70.3.0, rather than runtime dependencies, by adding narrowly scoped, expiring vulnerability exceptions and documenting the decision in the release notes. Reviewers should verify the PURLs match the SBOM findings, the image does not install the vulnerable packages at runtime, and the exceptions remain appropriately limited.

File-Level Changes

Change Details Files
Allowlist the three vulnerabilities found in pip’s vendored dependencies while constraining each exception to the affected package version and documenting its scope.
  • Add version-specific PURLs and expiry dates for the setuptools advisories.
  • Add a version-specific PURL and expiry date for the urllib3 advisory.
  • Update comments to identify pip’s actual SBOM path, build-time-only usage, and the dates used to verify the vendored versions.
.trivyignore.yaml
Document the security-scan exception in the release notes.
  • Explain that the accepted findings apply to pip-vendored urllib3 and setuptools copies.
  • Record the mitigation context, installed package versions, and exception expiry date.
docs/releases/1.0.0rc1.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4c392a8) to head (f17c465).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #326   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         2368      2368           
=========================================
  Hits          2368      2368           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 2, 2026 00:23

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".trivyignore.yaml" line_range="30" />
<code_context>
+  # can't be limited with `paths`; they would also hide these versions if
+  # installed normally
   - id: CVE-2025-47273
     purls: ["pkg:pypi/[email protected]"]
     statement: Vendored by pip, not used by the app (path traversal in PackageIndex, which pip doesn't use)
     expired_at: 2027-01-31
</code_context>
<issue_to_address>
**Vulnerable runtime code passes CI**

When a later lock or image change adds either exact ignored version as an installed dependency, trivy matches these exclusions by PURL, not by whether the package is pip's vendored copy, so CI passes with vulnerable runtime code in the image.

Remove these package-wide PURL ignores or otherwise ensure installed copies remain scanned.

Also at `.trivyignore.yaml:34`, `.trivyignore.yaml:42`.
</issue_to_address>

Linked issues

#325 fix: clear the urllib3 and setuptools image findings · 1 of 1 met

# Requirement Status Notes
1 Accept the three advisories in .trivyignore.yaml, limited to the vendored versions and expiring 2027-01-31. ✅ Met All three advisories have entries with the matching setuptools 70.3.0 or urllib3 2.7.0 purl, a statement, and the requested expiry.

Sourcery assessment

Needs a human reviewer. 1 finding to address first, the security scan did not finish, and these entries suppress findings by package URL, not by vendored-file path, so an image containing the same urllib3 or setuptools version as a normal installed package could pass scans without reporting the advisory. Reverting restores the findings, but an artifact released while that version is present could already have shipped with the vulnerability.

Blocking findings: .trivyignore.yaml:30


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .trivyignore.yaml Resolved
@uniqueg
uniqueg merged commit 631cb3f into dev Nov 2, 2026
52 of 56 checks passed
@uniqueg
uniqueg deleted the fix/trivy-pip-vendored branch November 2, 2026 00:36
@uniqueg uniqueg added the type: delivery Related to packaging, deployment etc. label Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: delivery Related to packaging, deployment etc. type: security Related to security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: clear the urllib3 and setuptools image findings

1 participant