Skip to content

Bump urllib3 to 2.7.0 (GHSA-mf9v-mfxr-j63j) - #126

Merged
adrienpessu merged 3 commits into
mainfrom
copilot/fix-urllib3-vulnerability
Sep 28, 2026
Merged

adrienpessu merged 3 commits into
mainfrom
copilot/fix-urllib3-vulnerability

Conversation

Copilot AI commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Pipfile.lock pinned urllib3 2.6.3, which is affected by GHSA-mf9v-mfxr-j63j / CVE-2026-44432 (high): decompression-bomb safeguards can be bypassed in the streaming API via incremental read(amt=N) on Brotli-encoded responses and via drain_conn() after partial decompression.

Changes

  • Pipfile: added an explicit urllib3 = ">=2.7.0" lower bound (urllib3 was previously only transitive, via ghastoolkit → requests).
  • Pipfile.lock: urllib3 2.6.3 → 2.7.0, produced with pipenv upgrade urllib3==2.7.0 so no unrelated packages are bumped. A plain pipenv lock would have moved ~12 other packages.
[packages]
pyyaml = "*"
ghastoolkit = "<=0.18.2"
urllib3 = ">=2.7.0"

Reachability assessment

Not reachable — high confidence. The advisory names specific APIs, and none are used here:

  • No module under codeqlsummarize/ or tests/ imports urllib3 or requests, or performs HTTP requests; there are no stream=/read(amt=...)/drain_conn() call sites.
  • urllib3 is pulled in only transitively. requests does not call drain_conn(), and neither brotli nor brotlicffi appears in the lock file, so the Brotli decoder path cannot be selected.

The bump is therefore to clear the scanner alert rather than to close an actively exercised path.

Note for reviewers

black . reports formatting differences in 22 files that this PR does not touch — pre-existing and unrelated.

Original prompt

This section details the Dependabot vulnerability alert you should resolve

<alert_title>urllib3: Decompression-bomb safeguards bypassed in parts of the streaming API</alert_title>
<alert_description>### Impact

urllib3's streaming API is designed for the efficient handling of large HTTP responses by reading the content in chunks, rather than loading the entire response body into memory at once.

urllib3 can perform decompression based on the HTTP Content-Encoding header (e.g., gzip, deflate, br, or zstd). When using the streaming API since version 2.6.0, the library decompresses only the necessary bytes, enabling partial content consumption.

However, urllib3 before version 2.7.0 could still decompress the whole response instead of the requested portion in two cases:

  1. During the second HTTPResponse.read(amt=N) call when the response was decompressed using the official Brotli library.
  2. When HTTPResponse.drain_conn() was called after the response had been read and decompressed partially (compression algorithm did not matter here).

These issues could cause urllib3 to fully decode a small amount of highly compressed data in a single operation. This could result in excessive resource consumption (high CPU usage and massive memory allocation for the decompressed data; CWE-409) on the client side.

Affected usages

Applications and libraries using urllib3 versions earlier than 2.7.0 may be affected when streaming compressed responses from untrusted sources in either of these cases, unless decompression is explicitly disabled:

  1. A response encoded with br is read incrementally with at least two HTTPResponse.read(amt=N) or HTTPResponse.stream(amt=N) calls while using the official Brotli library.
  2. HTTPResponse.drain_conn() is called after response decompression has already started.

Remediation

Upgrade to at least urllib3 version 2.7.0 in which the library:

  1. Is more efficient for reads with Brotli.
  2. Always skips decompression for HTTPResponse.drain_conn().

If upgrading is not immediately possible, the following workarounds may reduce exposure in specific cases:

  1. For the Brotli-specific issue only, switch from brotli to brotlicffi until you can upgrade urllib3; the official Brotli package is affected because of [Python] output_buffer_limit is not fully respected google/brotli#1396.
  2. If your code explicitly calls HTTPResponse.drain_conn(), call HTTPResponse.close() instead when connection reuse is not important.

Credits

The Brotli-specific issue was reported by @kimkou2024.
HTTPResponse.drain_conn() inefficiency was reported by @Cycloctane.</alert_description>

high
GHSA-mf9v-mfxr-j63j, CVE-2026-44432
urllib3
pip
<vulnerable_versions>= 2.6.3</vulnerable_versions>
<patched_version>2.7.0</patched_version>
<manifest_path>Pipfile.lock</manifest_path>

https://github.com/urllib3/urllib3/security/advisories/GHSA-mf9v-mfxr-j63j https://nvd.nist.gov/vuln/detail/CVE-2026-44432 https://github.com/pypa/advisory-database/tree/main/vulns/urllib3/PYSEC-2026-142.yaml https://github.com/advisories/GHSA-mf9v-mfxr-j63j

<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather than to address an active risk. If the advisory is too vague to determine reachability (e.g. 'improper input validation' with no specific API named), state that reachability could not be determined and explain why. Include a confidence level in the reachability assessment (e.g. high confidence if the advisory names a specific API and you confirmed it is or is not called, low confidence if the usage is indirect and hard to trace). If no patched version is available, check the alert_description field for a Workarounds section — the advisory may describe configuration changes or usage patterns that mitigate the vulnerability without a version u...

Copilot AI lite review requested due to automatic review settings September 28, 2026 07:22

Copilot AI 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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: adrienpessu <7055334+adrienpessu@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 28, 2026 07:24
Co-authored-by: adrienpessu <7055334+adrienpessu@users.noreply.github.com>

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The dependency is patched and locked; the remaining issue is only a minor reachability-description nit.

Review effort: Lite
Findings: None

Copilot AI changed the title [WIP] Fix urllib3 decompression-bomb safeguards Bump urllib3 to 2.7.0 (GHSA-mf9v-mfxr-j63j) Sep 28, 2026
Copilot AI requested a review from adrienpessu September 28, 2026 07:27
@adrienpessu
adrienpessu marked this pull request as ready for review September 28, 2026 07:29
@adrienpessu
adrienpessu requested a review from a team as a code owner September 28, 2026 07:29
@adrienpessu
adrienpessu requested a review from felickz September 28, 2026 07:29
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
pip/urllib3 2.7.0 UnknownUnknown

Scanned Files

  • Pipfile.lock

@Cycloctane

Cycloctane commented Sep 28, 2026 •

Copy link
Copy Markdown

@adrienpessu @felickz @GeekMasher Why am I receiving spam emails from this thread? I have nothing to do with your project. Please fix your CI (or whatever it is) as soon as possible!

@adrienpessu
adrienpessu merged commit 802d0fb into main Sep 28, 2026
5 checks passed
@adrienpessu
adrienpessu deleted the copilot/fix-urllib3-vulnerability branch September 28, 2026 13:54
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.

4 participants