73f5d1f9c1
- Backport security fixes from pip 21.1.1 - Resolve rpmlint warnings & fix changelog typos Mainly to fix CVE-2021-3572. Resolves: rhbz#1962856
34 lines
1.2 KiB
Diff
34 lines
1.2 KiB
Diff
From ca24e4bfa60cec8341ccf40000a41bc9592713df Mon Sep 17 00:00:00 2001
|
|
From: Karolina Surma <ksurma@redhat.com>
|
|
Date: Mon, 17 May 2021 11:34:30 +0200
|
|
Subject: [PATCH] Don't split git references on unicode separators
|
|
|
|
---
|
|
src/pip/_internal/vcs/git.py | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
diff --git a/src/pip/_internal/vcs/git.py b/src/pip/_internal/vcs/git.py
|
|
index cc22cd7..308e857 100644
|
|
--- a/src/pip/_internal/vcs/git.py
|
|
+++ b/src/pip/_internal/vcs/git.py
|
|
@@ -147,9 +147,15 @@ class Git(VersionControl):
|
|
on_returncode='ignore',
|
|
)
|
|
refs = {}
|
|
- for line in output.strip().splitlines():
|
|
+ # NOTE: We do not use splitlines here since that would split on other
|
|
+ # unicode separators, which can be maliciously used to install a
|
|
+ # different revision.
|
|
+ for line in output.strip().split("\n"):
|
|
+ line = line.rstrip("\r")
|
|
+ if not line:
|
|
+ continue
|
|
try:
|
|
- sha, ref = line.split()
|
|
+ sha, ref = line.split(" ", maxsplit=2)
|
|
except ValueError:
|
|
# Include the offending line to simplify troubleshooting if
|
|
# this error ever occurs.
|
|
--
|
|
2.31.1
|
|
|