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
This commit is contained in:
Martin Weinelt
2022-04-07 22:14:12 +02:00
parent 651a8e8782
commit acc99abf6a
@@ -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'"
'';