Skip to content

security: patch pip's vendored urllib3#68841

Open
twangboy wants to merge 3 commits intosaltstack:3006.xfrom
twangboy:patch/urllib3_vendored
Open

security: patch pip's vendored urllib3#68841
twangboy wants to merge 3 commits intosaltstack:3006.xfrom
twangboy:patch/urllib3_vendored

Conversation

@twangboy
Copy link
Copy Markdown
Contributor

What does this PR do?

security: patch pip's vendored urllib3 for CVE-2025-66418 and CVE-2026-21441

pip 25.2 vendors urllib3 1.26.20, which contains two security vulnerabilities that affect all Salt builds:

CVE-2025-66418 (GHSA-gm62-xv2j-4w53): An attacker-controlled
Content-Encoding header with more than 5 chained encodings could cause
unbounded resource consumption during decompression. Fixed by limiting
MultiDecoder to 5 links.

CVE-2026-21441 (GHSA-38jv-5279-wg99): drain_conn() unnecessarily
decompressed the full body of HTTP redirect responses even when
preload_content=False, creating a decompression-bomb vector. Fixed by
tracking _has_decoded_content and skipping decompression in drain_conn
when decoding was never initiated.

Both patches are backported from upstream urllib3 2.6.3 and validated against Ubuntu's Jammy 1.26.x security backports. CVE-2025-66471 is intentionally not backported — it requires a full 2.x streaming infrastructure refactor, Ubuntu did not backport it to 1.26.x, and pip's maintainers confirmed pip is not affected since all network calls use decode_content=False.

The patched files live in pkg/patches/pip-urllib3/ and are applied at build time by _build_patched_pip_wheel(), which downloads pip==25.2, rewrites the wheel zip with the patched urllib3 files, and updates the wheel's RECORD hashes. The patched wheel is then installed and/or copied into the virtualenv embed directory in all three build pipelines: onedir_dependencies, salt_onedir, and the macOS standalone path.

The version is reported as "2.6.3" to reflect the highest upstream release from which fixes were drawn, satisfying SCA scanner requirements.

What issues does this PR fix or reference?

Fixes BlackDuck

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@twangboy twangboy requested a review from a team as a code owner March 24, 2026 20:33
@twangboy twangboy added the test:full Run the full test suite label Mar 24, 2026
@twangboy twangboy self-assigned this Mar 24, 2026
@twangboy twangboy added this to the Sulpher v3006.24 milestone Mar 24, 2026
@twangboy twangboy changed the title security: patch pip's vendored urllib3 [WIP] security: patch pip's vendored urllib3 Mar 24, 2026
@twangboy twangboy force-pushed the patch/urllib3_vendored branch from 77aa6d7 to b2e80b2 Compare March 24, 2026 21:14
@dwoz dwoz removed the test:full Run the full test suite label Mar 25, 2026
Copy link
Copy Markdown
Collaborator

@sujitdb sujitdb left a comment

Choose a reason for hiding this comment

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

LGTM but is there any test which can verify it?

…6-21441

pip 25.2 vendors urllib3 1.26.20, which contains two security
vulnerabilities that affect all Salt builds:

  CVE-2025-66418 (GHSA-gm62-xv2j-4w53): An attacker-controlled
  Content-Encoding header with more than 5 chained encodings could cause
  unbounded resource consumption during decompression. Fixed by limiting
  MultiDecoder to 5 links.

  CVE-2026-21441 (GHSA-38jv-5279-wg99): drain_conn() unnecessarily
  decompressed the full body of HTTP redirect responses even when
  preload_content=False, creating a decompression-bomb vector. Fixed by
  tracking _has_decoded_content and skipping decompression in drain_conn
  when decoding was never initiated.

Both patches are backported from upstream urllib3 2.6.3 and validated
against Ubuntu's Jammy 1.26.x security backports. CVE-2025-66471 is
intentionally not backported — it requires a full 2.x streaming
infrastructure refactor, Ubuntu did not backport it to 1.26.x, and pip's
maintainers confirmed pip is not affected since all network calls use
decode_content=False.

The patched files live in pkg/patches/pip-urllib3/ and are applied at
build time by _build_patched_pip_wheel(), which downloads pip==25.2,
rewrites the wheel zip with the patched urllib3 files, and updates the
wheel's RECORD hashes. The patched wheel is then installed and/or copied
into the virtualenv embed directory in all three build pipelines:
onedir_dependencies, salt_onedir, and the macOS standalone path.

The version is reported as "2.6.3" to reflect the highest upstream
release from which fixes were drawn, satisfying SCA scanner requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants