Skip to content

Commit bab9944

Browse files
authored
[RAPTOR-14742] python311: Use system site packages for pip CVE (#1686)
Pip currently has a security vulnerability, CVE-2025-8869, which has been fixed but not released. The release date is undetermined as there are apparently resource allocation issues on the pip maintainer team. However, chainguard has applied this patch on their builds of pip. That said, when built the virtual env, we pulled in a virutalenv copy of pip, which reintroduced the CVE to the image. As such, we now use system site packages and do not pull in an updated pip. That way we can will get chainguard fixes that have been applied to python resources.
1 parent 0328ab3 commit bab9944

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

public_dropin_environments/python311/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COPY --from=build /bin/mkdir /bin/mkdir
3030

3131
# Required for custom-models to install dependencies
3232
COPY --from=build /usr/bin/pip /usr/bin/pip
33+
COPY --from=build /usr/lib/python3.11/site-packages/pip /usr/lib/python3.11/site-packages/pip
3334

3435
# Cleanup '__pycache__' directories. It solves an AsymmetricPrivateKey scanning error.
3536
COPY --from=build /usr/bin/rm /usr/bin/rm
@@ -42,10 +43,8 @@ COPY requirements.txt requirements.txt
4243

4344
ENV VIRTUAL_ENV=/opt/venv
4445

45-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
46+
RUN sh -c "python -m venv --without-pip --system-site-packages ${VIRTUAL_ENV} && \
4647
. ${VIRTUAL_ENV}/bin/activate && \
47-
python -m ensurepip --default-pip && \
48-
python -m pip install --upgrade pip && \
4948
python -m pip install --no-cache-dir -r requirements.txt && \
5049
find ${VIRTUAL_ENV} -type d -name '__pycache__' -exec rm -rf {} +"
5150

public_dropin_environments/python311/Dockerfile.local

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ COPY requirements.txt requirements.txt
1010

1111
ENV VIRTUAL_ENV=/opt/venv
1212

13-
RUN sh -c "python -m venv ${VIRTUAL_ENV} && \
13+
RUN sh -c "python -m venv --without-pip --system-site-packages ${VIRTUAL_ENV} && \
1414
. ${VIRTUAL_ENV}/bin/activate && \
15-
python -m pip install --upgrade pip && \
1615
python -m pip install --no-cache-dir -r requirements.txt"
1716

1817
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"id": "67a554baeade3a4ce2ab6700",
2+
"id": "67a554bbfbef3a4ce2ab6700",
33
"name": "[DataRobot] Python 3.11 Drop-In",
44
"description": "This template environment can be used to create Python based custom models. User is responsible to provide requirements.txt with the model, to install all the required dependencies.",
55
"programmingLanguage": "python",
66
"label": "",
7-
"environmentVersionId": "68ddb0110008035274003e75",
7+
"environmentVersionId": "67a554bbfbef4b4ce2ab6700",
88
"environmentVersionDescription": "",
99
"isPublic": true,
1010
"isDownloadable": true,
@@ -14,8 +14,8 @@
1414
"contextUrl": "https://github.com/datarobot/datarobot-user-models/tree/master/public_dropin_environments/python311",
1515
"imageRepository": "env-python",
1616
"tags": [
17-
"v11.2.0-68ddb0110008035274003e75",
18-
"68ddb0110008035274003e75",
17+
"v11.2.0-67a554bbfbef4b4ce2ab6700",
18+
"67a554bbfbef4b4ce2ab6700",
1919
"v11.2.0-latest"
2020
]
2121
}

0 commit comments

Comments
 (0)