Skip to content

Commit 855c5ff

Browse files
aninda-aljslobodzianKanishk-Bansal
authored
1 parent c78b73f commit 855c5ff

File tree

11 files changed

+3027
-30
lines changed

11 files changed

+3027
-30
lines changed

SPECS/python3/CVE-2023-45803.patch

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
From b594c5ceaca38e1ac215f916538fb128e3526a36 Mon Sep 17 00:00:00 2001
2+
From: Illia Volochii <[email protected]>
3+
Date: Tue, 17 Oct 2023 19:35:39 +0300
4+
Subject: [PATCH] Merge pull request from GHSA-g4mx-q9vg-27p4
5+
Upstream Patch Reference: https://github.com/urllib3/urllib3/commit/b594c5ceaca38e1ac215f916538fb128e3526a36.patch
6+
---
7+
pip/_vendor/urllib3/_collections.py | 18 ++++++++++++++++++
8+
pip/_vendor/urllib3/connectionpool.py | 5 +++++
9+
pip/_vendor/urllib3/poolmanager.py | 6 +++++-
10+
3 files changed, 28 insertions(+), 1 deletion(-)
11+
12+
diff --git a/pip/_vendor/urllib3/_collections.py b/pip/_vendor/urllib3/_collections.py
13+
index da9857e..bceb845 100644
14+
--- a/pip/_vendor/urllib3/_collections.py
15+
+++ b/pip/_vendor/urllib3/_collections.py
16+
@@ -268,6 +268,24 @@ class HTTPHeaderDict(MutableMapping):
17+
else:
18+
return vals[1:]
19+
20+
+ def _prepare_for_method_change(self):
21+
+ """
22+
+ Remove content-specific header fields before changing the request
23+
+ method to GET or HEAD according to RFC 9110, Section 15.4.
24+
+ """
25+
+ content_specific_headers = [
26+
+ "Content-Encoding",
27+
+ "Content-Language",
28+
+ "Content-Location",
29+
+ "Content-Type",
30+
+ "Content-Length",
31+
+ "Digest",
32+
+ "Last-Modified",
33+
+ ]
34+
+ for header in content_specific_headers:
35+
+ self.discard(header)
36+
+ return self
37+
+
38+
# Backwards compatibility for httplib
39+
getheaders = getlist
40+
getallmatchingheaders = getlist
41+
diff --git a/pip/_vendor/urllib3/connectionpool.py b/pip/_vendor/urllib3/connectionpool.py
42+
index 7087392..d954e4b 100644
43+
--- a/pip/_vendor/urllib3/connectionpool.py
44+
+++ b/pip/_vendor/urllib3/connectionpool.py
45+
@@ -9,6 +9,7 @@ import warnings
46+
from socket import error as SocketError
47+
from socket import timeout as SocketTimeout
48+
49+
+from ._collections import HTTPHeaderDict
50+
from .connection import (
51+
BaseSSLError,
52+
BrokenPipeError,
53+
@@ -832,7 +833,11 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
54+
redirect_location = redirect and response.get_redirect_location()
55+
if redirect_location:
56+
if response.status == 303:
57+
+ # Change the method according to RFC 9110, Section 15.4.4.
58+
method = "GET"
59+
+ # And lose the body not to transfer anything sensitive.
60+
+ body = None
61+
+ headers = HTTPHeaderDict(headers)._prepare_for_method_change()
62+
63+
try:
64+
retries = retries.increment(method, url, response=response, _pool=self)
65+
diff --git a/pip/_vendor/urllib3/poolmanager.py b/pip/_vendor/urllib3/poolmanager.py
66+
index 0e56754..3da5074 100644
67+
--- a/pip/_vendor/urllib3/poolmanager.py
68+
+++ b/pip/_vendor/urllib3/poolmanager.py
69+
@@ -4,7 +4,7 @@ import collections
70+
import functools
71+
import logging
72+
73+
-from ._collections import RecentlyUsedContainer
74+
+from ._collections import HTTPHeaderDict, RecentlyUsedContainer
75+
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme
76+
from .exceptions import (
77+
LocationValueError,
78+
@@ -400,7 +400,11 @@ class PoolManager(RequestMethods):
79+
80+
# RFC 7231, Section 6.4.4
81+
if response.status == 303:
82+
+ # Change the method according to RFC 9110, Section 15.4.4.
83+
method = "GET"
84+
+ # And lose the body not to transfer anything sensitive.
85+
+ kw["body"] = None
86+
+ kw["headers"] = HTTPHeaderDict(kw["headers"])._prepare_for_method_change()
87+
88+
retries = kw.get("retries", response.retries)
89+
if not isinstance(retries, Retry):
90+
--
91+
2.34.1
92+

SPECS/python3/CVE-2023-5752.patch

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 389cb799d0da9a840749fcd14878928467ed49b4 Mon Sep 17 00:00:00 2001
2+
From: Pradyun Gedam <[email protected]>
3+
Date: Sun, 1 Oct 2023 14:10:25 +0100
4+
Subject: [PATCH] Use `-r=...` instead of `-r ...` for hg
5+
This ensures that the resulting revision can not be misinterpreted as an
6+
option.
7+
Upstream Patch Reference: https://github.com/pypa/pip/pull/12306/commits/389cb799d0da9a840749fcd14878928467ed49b4.patch
8+
9+
---
10+
.../pip/_internal/vcs/mercurial.py | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/pip/_internal/vcs/mercurial.py b/pip/_internal/vcs/mercurial.py
14+
index 2a005e0..e440c12 100644
15+
--- a/pip/_internal/vcs/mercurial.py
16+
+++ b/pip/_internal/vcs/mercurial.py
17+
@@ -31,7 +31,7 @@ class Mercurial(VersionControl):
18+
19+
@staticmethod
20+
def get_base_rev_args(rev: str) -> List[str]:
21+
- return [rev]
22+
+ return [f"-r={rev}"]
23+
24+
def fetch_new(
25+
self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int
26+
--
27+
2.45.2
28+

0 commit comments

Comments
 (0)