python3-pip: Fix CVE-2026-8643
PATCH v2 1/1 python3-pip: Fix CVE-2026-8643
From: Hetvi Thakar <[email protected]>
This patch backports the upstream fix for CVE-2026-8643 and the two follow-up regression fixes. The primary commit is included in pip 26.1.2 and referenced in [1]. The public CVE advisory is referenced in [2].
The first follow-up fixes doubled-slash directory handling and the second reuses pip's shared directory-containment helper. The upstream regression commits are referenced in [3] and [4].
[1] https://github.com/pypa/pip/commit/8eb178480bd1a2b223f509fc430796b265158dfb
[2] https://github.com/advisories/GHSA-wf93-45jw-7689
[3] https://github.com/pypa/pip/commit/7ff8bdd81ec5edca2bebf78ad8506dda710d6af5
[4] https://github.com/pypa/pip/commit/fa7854f6b37113a2c4698cdde902e1fcc9bebdd5
---
Changes in v2:
- Added the two regression commits
--- .../CVE-2026-8643-regression_p1.patch | 35 ++++++++ .../CVE-2026-8643-regression_p2.patch | 69 ++++++++++++++++ .../python/python3-pip/CVE-2026-8643.patch | 80 +++++++++++++++++++ .../python/python3-pip_26.0.1.bb | 6 +- 4 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/python/python3-pip/CVE-2026-8643-regression_p1.patch create mode 100644 meta/recipes-devtools/python/python3-pip/CVE-2026-8643-regression_p2.patch create mode 100644 meta/recipes-devtools/python/python3-pip/CVE-2026-8643.patch
meta/recipes-devtools/python/python3-pip/CVE-2026-8643-regression_p1.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 7ff8bdd81ec5edca2bebf78ad8506dda710d6af5 Mon Sep 17 00:00:00 2001 +From: Damian Shaw <[email protected]> +Date: Mon, 18 May 2026 23:22:51 -0400 +Subject: [PATCH] Fix is_within_directory for doubled-slash roots + +CVE: CVE-2026-8643 +Upstream-Status: Backport [https://github.com/pypa/pip/commit/7ff8bdd81ec5edca2bebf78ad8506dda710d6af5] + +Backport Changes: +- Omitted tests/unit/test_utils_unpacking.py because the pip 26.0.1 + PyPI sdist used by this recipe does not ship the upstream tests + directory. + +(cherry picked from commit 7ff8bdd81ec5edca2bebf78ad8506dda710d6af5) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + src/pip/_internal/utils/unpacking.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/pip/_internal/utils/unpacking.py b/src/pip/_internal/utils/unpacking.py +index 879b40c37e..ba7cb52579 100644 +--- a/src/pip/_internal/utils/unpacking.py ++++ b/src/pip/_internal/utils/unpacking.py +@@ -83,8 +83,7 @@ def is_within_directory(directory: str, target: str) -> bool: + abs_directory = os.path.abspath(directory) + abs_target = os.path.abspath(target) + +- prefix = os.path.commonpath([abs_directory, abs_target]) +- return prefix == abs_directory ++ return abs_target == abs_directory or abs_target.startswith(abs_directory + os.sep) + + + def _get_default_mode_plus_executable() -> int: +-- +2.35.6
meta/recipes-devtools/python/python3-pip/CVE-2026-8643-regression_p2.patch new file +69 -0
69 lines not on this page · raw message
meta/recipes-devtools/python/python3-pip/CVE-2026-8643.patch new file +80 -0
80 lines not on this page · raw message
meta/recipes-devtools/python/python3-pip_26.0.1.bb +5 -1
@@ -24,7 +24,11 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=63ec52baf95163b597008bb46db68030 \ inherit pypi python_setuptools_build_meta -SRC_URI += "file://no_shebang_mangling.patch" +SRC_URI += "file://no_shebang_mangling.patch \ + file://CVE-2026-8643.patch \ + file://CVE-2026-8643-regression_p1.patch \ + file://CVE-2026-8643-regression_p2.patch \ + " SRC_URI[sha256sum] = "c4037d8a277c89b320abe636d59f91e6d0922d08a05b60e85e53b296613346d8"
Signature · 1 line
2.35.6