From patchwork Thu Nov 5 08:59:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 103100 Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.30265.1793869209177458011 for ; Thu, 05 Nov 2026 01:00:09 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=KJjf27r1; spf=pass (domain: cisco.com, ip: 173.37.86.76, mailfrom: hthakar@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=7840; q=dns/txt; s=iport01; t=1793869209; x=1795078809; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+jaZV3gZM7dUEeZZcAb31dxCq0IyiQtkrLceKyRyQT4=; b=KJjf27r1Qej6ldKMdPFwNk5WNZCRYC1FPoAcV7yYziaU4AoIFG0z1HIZ dwI423dIiAnMY7tdhtk6R9iTkzJK792wMLngsFUU7iqPo9os6LBZZAcVu 70eQrqumR8U4czycEQsWHE6DswMa0rZRv2nJ6IjlJjXBsBhvwYwW3Yfyk WAXrC9vPMPTZzBO/v6g053+Ct+212wFSyQFFeMhNRDMSSEIJ+8SQgiM2h 9dUDaoZ1RnGrzhXFigLSykihgNOCaRdTCNYtJSgmCOvvcZ2ddYzVLshW8 KyhcKECvrda51ovHDg7UYeqwluzBIdAkyK1PnaKyCxQOkNSBehQ5VA2C5 Q==; X-CSE-ConnectionGUID: 9xL5NoUTSN61bfGZIsE2Xw== X-CSE-MsgGUID: KkZ4d4nXSX6smRBfAceyGA== X-IPAS-Result: A0CFAADGROxq/5P/Ja1aHQEBAQEJARIBBQUBgX4GAQsBglZ1YAo5SQOEVI9TgiEDgROKUp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j3r2aRVTqUmeouw85G27IAlZjeSxYIWJIYXXLSlTtmWbl D7Ko2LJOSFEL9ml4zSs+X+9qcaayEsXX6pXTtVU7MVCh0WewGEWAhAaWVa35PW0lEO6c9ZeM FAPvC02oK4/8UamQtXwU1u/unHsg/IHc8BbH+t/7ESGzbDZpl/BQGMFVTVGLtchsafaWAAX6 7NApPuxbRQHjVFfYSv1Gmu8xd9qBRUoEA== IronPort-HdrOrdr: A9a23:LCoC/qGLC1zj0qOzpLqEyseALOsnbusQ8zAXPidKOHtom62j5q STdZsguyMc5Ax9ZJhko6HiBEDiewK4yXcK2+gs1N6ZNWGM0ldAbrsSj7cKqAeOJ8SRzIJgPN 9bE5RWOZnXEUVwi9r87U2TFtYtx8TCzYWT7N2uqUuEiWpRGtldB8ATMHfjLnFL X-Talos-CUID: 9a23:VGvOoG/mmWSz1eTdRjmVvx8EPp0DdUDh91GOekW2JlRIU5DPeUDFrQ== X-Talos-MUID: 9a23:Qw2U4Aul9FpJN1Tloc2npzJQaMs05ZSVOB4WlK8steCPOD1fEmLI X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,196,1787011200"; d="scan'208";a="544874315" Received: from rcdn-l-core-10.cisco.com ([173.37.255.147]) by rcdn-iport-5.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 05 Nov 2026 09:00:08 +0000 Received: from sjc-ads-5245.cisco.com (sjc-ads-5245.cisco.com [10.28.23.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by rcdn-l-core-10.cisco.com (Postfix) with ESMTPS id 28C411800027C for ; Thu, 5 Nov 2026 09:00:08 +0000 (GMT) Received: by sjc-ads-5245.cisco.com (Postfix, from userid 1887505) id 7748FCBF21E; Thu, 5 Nov 2026 01:00:07 -0800 (PST) From: "Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Subject: [meta-python][wrynose][PATCH 05/18] python3-virtualenv: fix CVE-2026-113776 Date: Thu, 5 Nov 2026 00:59:54 -0800 Message-Id: <20261105090007.351866-6-hthakar@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261105090007.351866-1-hthakar@cisco.com> References: <20261105090007.351866-1-hthakar@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5245.cisco.com [10.28.23.9];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.23.9, sjc-ads-5245.cisco.com X-Outbound-Node: rcdn-l-core-10.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 05 Nov 2026 09:00:21 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/131885 From: Hetvi Thakar This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. Replace activation-template placeholders in a single pass so placeholder names inside substituted paths or prompts cannot be expanded again as script content. [1] https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74 [2] https://github.com/pypa/virtualenv/security/advisories/GHSA-8rjx-v5ww-45pp Signed-off-by: Hetvi Thakar --- .../python3-virtualenv/CVE-2026-113776.patch | 133 ++++++++++++++++++ .../python/python3-virtualenv_21.2.1.bb | 1 + 2 files changed, 134 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-virtualenv/CVE-2026-113776.patch diff --git a/meta-python/recipes-devtools/python/python3-virtualenv/CVE-2026-113776.patch b/meta-python/recipes-devtools/python/python3-virtualenv/CVE-2026-113776.patch new file mode 100644 index 0000000000..c1e034edb5 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-virtualenv/CVE-2026-113776.patch @@ -0,0 +1,133 @@ +From 602b26623a724827ff171bf11fef4ad186d01f74 Mon Sep 17 00:00:00 2001 +From: Bernát Gábor +Date: Wed, 30 Sep 2026 23:01:05 -0700 +Subject: [PATCH] Merge commit from fork + +instantiate_template replaced one placeholder at a time across the whole +template, so a placeholder name inside an already quoted value, such as a +parent directory named __VIRTUAL_NAME__, was rewritten from inside the +finished literal. The second value's quotes closed the first, and the rest +of the path ran as code in bash, fish, xonsh and activate_this.py; in csh +the prompt display tokens broke activate.csh the same way. + +Build every token's final text first and substitute them in one regex pass, +with the csh display tokens joining that pass through substitutions(). + +CVE: CVE-2026-113776 +Upstream-Status: Backport [https://github.com/pypa/virtualenv/commit/602b26623a724827ff171bf11fef4ad186d01f74] + +Backport Changes: +- Omit the Csh display-token override and its specific test: 21.2.1 has + no separate display-token substitution or prompt-literal helpers. + Its Csh activator uses the corrected shared template substitution. +- Exercise upstream's placeholder-in-parent-directory regression through + the existing Bash relocation fixture, since 21.2.1 lacks the later + prompt-test fixture. Add direct one-pass substitution checks for the + existing Bash, Csh, Fish and Python activators, and retain the 21.2.1 + special-character fixture's other characters. + +Signed-off-by: Hetvi Thakar +--- + src/virtualenv/activation/via_template.py | 21 +++++++++++++++++---- + tests/conftest.py | 3 ++- + tests/unit/activation/test_activator.py | 16 ++++++++++++++++ + tests/unit/activation/test_bash.py | 1 + + 4 files changed, 36 insertions(+), 5 deletions(-) + +diff --git a/src/virtualenv/activation/via_template.py b/src/virtualenv/activation/via_template.py +index 926c2b0..3af9dc5 100644 +--- a/src/virtualenv/activation/via_template.py ++++ b/src/virtualenv/activation/via_template.py +@@ -1,6 +1,7 @@ + from __future__ import annotations + + import os ++import re + import shlex + import sys + from abc import ABC, abstractmethod +@@ -84,10 +85,22 @@ class ViaTemplateActivator(Activator, ABC): + # read content as binary to avoid platform specific line normalization (\n -> \r\n) + binary = read_binary(self.__module__, template) + text = binary.decode("utf-8", errors="strict") +- for key, value in replacements.items(): +- value_uni = self._repr_unicode(creator, value) +- text = text.replace(key, self.quote(value_uni)) +- return text ++ substitutions = self.substitutions(replacements, creator) ++ # one pass over the template, so a placeholder name inside an already quoted value (a path component named ++ # __VIRTUAL_NAME__) stays data instead of being rewritten by a later key from inside the finished literal ++ pattern = re.compile("|".join(re.escape(key) for key in sorted(substitutions, key=len, reverse=True))) ++ return pattern.sub(lambda match: substitutions[match.group()], text) ++ ++ def substitutions(self, replacements: dict[str, str], creator: Creator) -> dict[str, str]: ++ """Map each placeholder to the final text that replaces it in the template. ++ ++ :param replacements: the raw placeholder values ++ :param creator: the creator of the environment ++ ++ :returns: the placeholder to substituted text mapping ++ ++ """ ++ return {key: self.quote(self._repr_unicode(creator, value)) for key, value in replacements.items()} + + @staticmethod + def _repr_unicode(creator: Creator, value: str) -> str: # noqa: ARG004 +diff --git a/tests/conftest.py b/tests/conftest.py +index 3ec4147..f27c450 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -279,7 +279,8 @@ def is_inside_ci(): + + @pytest.fixture(scope="session") + def special_char_name(): +- base = "'\";&&e-$ èрт