From acc99abf6a4a25ec0796cbcb7a9faf487e56cea8 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 5 Apr 2022 23:04:45 +0200 Subject: [PATCH] python3Packages.twisted: Patch HTTP request smuggling issue Fixes HTTP request smuggling in HTTP/1.1 server and proxy implementation caused by insufficient validation of HTTP request headers. Fixes: CVE-20222-24801 --- .../python-modules/twisted/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/twisted/default.nix b/pkgs/development/python-modules/twisted/default.nix index 4641e4af4046..25a9753400eb 100644 --- a/pkgs/development/python-modules/twisted/default.nix +++ b/pkgs/development/python-modules/twisted/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , buildPythonPackage +, fetchpatch , fetchPypi , python , zope_interface @@ -25,13 +26,25 @@ buildPythonPackage rec { sha256 = "1wml02jxni8k15984pskks7d6yin81w4d2ac026cpyiqd0gjpwsp"; }; + patches = [ + (fetchpatch { + # https://github.com/twisted/twisted/security/advisories/GHSA-c2jg-hw38-jrqq + name = "CVE-2022-24801.patch"; + url = "https://github.com/twisted/twisted/commit/592217e951363d60e9cd99c5bbfd23d4615043ac.patch"; + hash = "sha256-psX5vAM9myuILuTazpebSk8QTT52CB6N7RXAY4MAV8g="; + excludes = [ + "src/twisted/web/newsfragments/10323.bugfix" + ]; + }) + ]; + propagatedBuildInputs = [ zope_interface incremental automat constantly hyperlink pyhamcrest attrs setuptools typing-extensions ]; passthru.extras.tls = [ pyopenssl service-identity idna ]; # Patch t.p._inotify to point to libc. Without this, # twisted.python.runtime.platform.supportsINotify() == False - patchPhase = lib.optionalString stdenv.isLinux '' + postPatch = lib.optionalString stdenv.isLinux '' substituteInPlace src/twisted/python/_inotify.py --replace \ "ctypes.util.find_library(\"c\")" "'${stdenv.glibc.out}/lib/libc.so.6'" '';