Skip to content

fix: accept advisories vendored by pip - #386

Merged
uniqueg merged 1 commit into
devfrom
fix/383-vendored-advisories
Nov 1, 2026
Merged

uniqueg merged 1 commit into
devfrom
fix/383-vendored-advisories

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #383

The three alerts do not come from installed packages. uv.lock already has urllib3 2.8.0 and no setuptools is installed (the base image elixircloud/foca:0.19.0-py3.13 has urllib3 2.8.0 and no setuptools either). Trivy reports the copies vendored by pip 26.2.2 (latest release): urllib3 2.7.0 and setuptools 70.3.0 (pip/_vendor/vendor.txt). pip only runs at build time. Neither can be updated while keeping pip, and dropping pip is #336 (deferred by the maintainer).

This PR adds the three advisories to .trivyignore.yaml, as the neighbouring entries (and foca#562), limited to the vendored versions, expiring 2027-01-31:

The entries are grouped by package. No docs change: behaviour and image contents are unchanged.

Verification

  • docker build of the image, then pip list and find in it: urllib3 2.8.0, no setuptools, only pip's vendored copies.
  • Trivy 0.75.0 (docker) on the built image without the ignore file: reports the three advisories on the vendored copies. With this .trivyignore.yaml: no Python package finding left (only unfixed Debian OS findings, which the CI scan does not fail on).
  • CI: all checks passed, including Scan image.

Lane: regular. Adversarial and quality review: no high or medium findings. Declined: none; the two low findings (grouping by package, shorter statement) were applied.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Enhancements:

  • Add time-limited Trivy exceptions for three advisories affecting pip-vendored urllib3 and setuptools copies that are not used by the application.

Add CVE-2026-97688 (urllib3 2.7.0), CVE-2026-59890 and
GHSA-xmj3-9gf7-h52w (setuptools 70.3.0) to .trivyignore.yaml, limited
to the package versions, with the expiry of the neighbouring entries
(2027-01-31). The image has no such installed packages: uv.lock and
the base image have urllib3 2.8.0 and no setuptools; Trivy reports
the copies vendored by pip 26.2.2 (latest), which only runs at build
time. Dropping pip stays with #336.

Closes #383

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates the Trivy ignore configuration to suppress three advisories that apply only to pip 26.2.2’s vendored setuptools 70.3.0 and urllib3 2.7.0 copies, while preserving scan coverage through package/version-specific entries, rationale statements, and an expiration date; application dependencies and image contents are unchanged.

File-Level Changes

Change Details Files
Add narrowly scoped Trivy ignores for vulnerabilities detected only in pip’s vendored dependencies.
  • Ignore two setuptools advisories for the vendored 70.3.0 copy.
  • Ignore one urllib3 advisory for the vendored 2.7.0 copy.
  • Document pip build-time usage, exploit constraints, affected package URLs, and a 2027-01-31 expiration for each entry.
  • Group the new entries with the existing setuptools and urllib3 ignores.
.trivyignore.yaml

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 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (763f50d) to head (66ceae3).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #386   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         2217      2217           
=========================================
  Hits          2217      2217           

☔ 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 1, 2026 21:24

@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 2 issues

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

## Individual Comments

### Comment 1
<location path=".trivyignore.yaml" line_range="45" />
<code_context>
+    statement: Vendored by pip, not used by the app (Windows path escape in legacy wheel installation; the image runs Linux)
+    expired_at: 2027-01-31
   - id: CVE-2026-97687
     purls: ["pkg:pypi/[email protected]"]
     statement: Vendored by pip, not used by the app (pip only runs at build time)
</code_context>
<issue_to_address>
**Vulnerable app packages pass scans**

When the image contains setuptools 70.3.0 or urllib3 2.7.0 as installed application dependencies, the `purls` filters match only package and version, so Trivy suppresses the findings for installed application copies too and the CI image scan passes with a vulnerable runtime package.

Change the ignores so they do not suppress findings for installed application dependencies.

Also at `.trivyignore.yaml:29`, `.trivyignore.yaml:33`.
</issue_to_address>

### Comment 2
<location path=".trivyignore.yaml" line_range="46" />
<code_context>
     expired_at: 2027-01-31
+  - id: CVE-2026-97688
+    purls: ["pkg:pypi/[email protected]"]
+    statement: Vendored by pip, not used by the app (infinite loop in chunked Deflate decoding; pip only runs at build time)
+    expired_at: 2027-01-31
   - id: GHSA-6v7p-g79w-8964
</code_context>
<issue_to_address>
**Builds hang on crafted index responses**

When the package index or an intermediary returns a chunked Deflate response that triggers CVE-2026-97688, pip uses its vendored urllib3 to fetch dependencies, and the vulnerable Deflate decoder loops indefinitely on the crafted response. The Docker build then stalls until the CI job timeout, blocking image publication.

Use a pip version with a fixed vendored urllib3, or otherwise prevent vulnerable pip from processing untrusted index responses during builds.
</issue_to_address>

Linked issues

#383 fix: update urllib3 and setuptools in the image · 2 of 4 met · 1 to check by hand

# Requirement Status Notes
1 Update urllib3 to 2.8.0 or later in uv.lock ✅ Met uv.lock already pins urllib3 2.8.0.
2 Find out where setuptools 70.3.0 comes from ✅ Met The change identifies it as pip's vendored copy, not an installed application package.
3 Remove setuptools from the image or update it; if it comes with pip, do this together with #336 ❌ Not addressed The image's pip and its vendored setuptools remain; this change only adds Trivy ignores for the advisories.
4 Check that the code scanning alerts close after the next dev scan 👀 Check by hand (external system) Confirm that the three alerts close in code scanning after the next dev image scan.

Sourcery assessment

Needs a human reviewer. 2 findings to address first, the security scan did not finish, and these entries make Trivy silently stop reporting the named advisories for the specified package versions; if the vendoring or non-use assumptions are wrong, affected code can remain unpatched without the scan signaling it. Reverting restores future findings, but it cannot undo exposure or any compromise that occurred while they were suppressed.

Blocking findings: .trivyignore.yaml:45, .trivyignore.yaml:46


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

Comment thread .trivyignore.yaml Resolved
Comment thread .trivyignore.yaml Resolved
@uniqueg
uniqueg merged commit 105c6f5 into dev Nov 1, 2026
52 of 56 checks passed
@uniqueg
uniqueg deleted the fix/383-vendored-advisories branch November 1, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: update urllib3 and setuptools in the image

1 participant