[Medium] Patch python-virtualenv for CVE-2025-50181, CVE-2026-24049, CVE-2026-1703#15951
Conversation
| abs_directory = os.path.abspath(directory) | ||
| abs_target = os.path.abspath(target) | ||
|
|
||
| - prefix = os.path.commonprefix([abs_directory, abs_target]) |
| abs_target = os.path.abspath(target) | ||
|
|
||
| - prefix = os.path.commonprefix([abs_directory, abs_target]) | ||
| + prefix = os.path.commonpath([abs_directory, abs_target]) |
| # https://github.com/python/cpython/issues/59999 | ||
| permissions = zinfo.external_attr >> 16 & 0o777 | ||
| - destination.joinpath(zinfo.filename).chmod(permissions) | ||
| + target_path.chmod(permissions) |
| # We have to do this manually due to | ||
| # https://github.com/python/cpython/issues/59999 | ||
| permissions = zinfo.external_attr >> 16 & 0o777 | ||
| - destination.joinpath(zinfo.filename).chmod(permissions) |
|
|
||
| def __init__(self, num_pools=10, headers=None, **connection_pool_kw): | ||
| RequestMethods.__init__(self, headers) | ||
| + if "retries" in connection_pool_kw: |
| # For the poolmanager.py under tests, it is archived inside a .whl file, which in turn is archived inside another .whl file, | ||
| # so, we need to unpack the outer .whl, then unpack the inner .whl, apply the patch, and then re-zip both levels. | ||
|
|
||
| echo "Manually Patching virtualenv-20.36.1/src/virtualenv/seed/wheels/embed/pip-25.0.1-py3-none-any.whl/pip/_vendor/urllib3/poolmanager.py" |
There was a problem hiding this comment.
Can we please add a note above each of this to clarify what patch. Also a comment so that we can justify why we are duplicating code, as the two parts alsmost are similar.
There was a problem hiding this comment.
Affected code is present in archive(.whl) files in source tarball and even though patch is same for diffrent archives, same patch is not applicable for affected archives due to different versions. So same procedure is repeated for different archives.
kgodara912
left a comment
There was a problem hiding this comment.
The patches almost match with upstream references except unimportant files. The changes are included in final rpm whl files. Buddy build is successful. Though, there are other possible ways to fix this, like keeping only one version of setuptools and pip in virtualenv, but as such it should work.
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./LICENSES-AND-NOTICES/SPECS/data/licenses.json,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
Patch python-virtualenv for CVE-2025-50181 [Medium]
Patch python-virtualenv for CVE-2026-24049 [Medium]
docs/news.rstandtests/commands/test_unpack.pyfiles are not present in python-virtualenv source tarball, so patch didn't apply for these two files.Patch python-virtualenv for CVE-2026-1703 [Low]
tests/unit/test_utils_unpacking.pyfile is not present in python-virtualenv source tar ball, so patch didn't apply.pip-25.3-py3-none-any.whlthenews/+1ee322a1.bugfix.rstnew path is not added from upstream patch to maintain compatibility with existing virtualenv cleanup behavior after tightening path validation logic (commonpath). This avoids leaving non-runtime artifacts in site-packages during pip uninstall and allows existing tests to pass without modifying test code.Change Log
Does this affect the toolchain?
NO
Links to CVEs
Test Methodology
Local Build:
python-virtualenv-20.36.1-2.azl3.src.rpm.log
python-virtualenv-20.36.1-2.azl3.src.rpm.test.log
Patch applies cleanly: