Skip to content

Commit a2f3ff7

Browse files
committed
update get-pip to look for sha
1 parent c3328f5 commit a2f3ff7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

bin/steps/python

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,17 @@ fi
101101
# https://github.com/pypa/get-pip
102102
GETPIP="https://lang-python.s3.amazonaws.com/etc/get-pip.py"
103103

104-
if ! curl "${GETPIP}" -o "$ROOT_DIR/get-pip.py"; then
105-
mcount "failure.python.get-pip"
106-
echo "Failed to pull down get-pip"
107-
exit 1
104+
# Grab SHA from get-pip
105+
CHECK_SHA="$(curl -s "$GETPIP" | sha256sum | cut -d ' ' -f 1)"
106+
107+
# validate the sha is the same one we want
108+
if [ ! "$CHECK_SHA" == "$GETPIP_SHA" ]; then
109+
mcount "failure.python.get-pip.wrong-sha"
110+
echo "Incorrect SHA found"
111+
exit 1
112+
else
113+
curl "$GETPIP" -o "$ROOT_DIR/get-pip.py"
114+
mcount "python.get-pip.install"
108115
fi
109116

110117
# If Pip isn't up to date:
@@ -116,7 +123,7 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
116123
rm -fr /app/.heroku/python/lib/python*/site-packages/pip-*
117124
rm -fr /app/.heroku/python/lib/python*/site-packages/setuptools-*
118125

119-
/app/.heroku/python/bin/python "$ROOT_DIR/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
126+
/app/.heroku/python/bin/python "$ROOT_DIR/get-pip.py" pip=="$PIP_UPDATE" #&> /dev/null
120127
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
121128
fi
122129

0 commit comments

Comments
 (0)