Skip to content

Commit b4151b1

Browse files
committed
RHAIENG-987: remove skopeo and OpenShift client installation from RStudio Dockerfiles to address CVE-2025-4674
1 parent 35d3345 commit b4151b1

File tree

6 files changed

+25
-42
lines changed

6 files changed

+25
-42
lines changed

rstudio/c9s-python-3.11/Dockerfile.cpu

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,12 @@ RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_d
2323
# upgrade first to avoid fixable vulnerabilities end
2424

2525
# Install useful OS packages
26-
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
26+
# remove skopeo, CVE-2025-4674
27+
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum
2728

2829
# Other apps and tools installed as default user
2930
USER 1001
3031

31-
# Install the oc client begin
32-
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
33-
-o /tmp/openshift-client-linux.tar.gz && \
34-
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
35-
rm -f /tmp/openshift-client-linux.tar.gz
36-
# Install the oc client end
37-
3832
WORKDIR /opt/app-root/src
3933

4034
#####################

rstudio/c9s-python-3.11/Dockerfile.cuda

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,12 @@ RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_d
2525
# upgrade first to avoid fixable vulnerabilities end
2626

2727
# Install useful OS packages
28-
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
28+
# remove skopeo, CVE-2025-4674
29+
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum
2930

3031
# Other apps and tools installed as default user
3132
USER 1001
3233

33-
# Install the oc client begin
34-
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
35-
-o /tmp/openshift-client-linux.tar.gz && \
36-
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
37-
rm -f /tmp/openshift-client-linux.tar.gz
38-
# Install the oc client end
39-
4034
WORKDIR /opt/app-root/src
4135

4236
#####################

rstudio/rhel9-python-3.11/Dockerfile.cpu

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_d
1818
# upgrade first to avoid fixable vulnerabilities end
1919

2020
# Install useful OS packages
21-
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
21+
# remove skopeo, CVE-2025-4674
22+
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum
2223

2324
# Other apps and tools installed as default user
2425
USER 1001
2526

26-
# Install the oc client begin
27-
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
28-
-o /tmp/openshift-client-linux.tar.gz && \
29-
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
30-
rm -f /tmp/openshift-client-linux.tar.gz
31-
# Install the oc client end
32-
3327
WORKDIR /opt/app-root/src
3428

3529
#####################

rstudio/rhel9-python-3.11/Dockerfile.cuda

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,12 @@ RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_d
2020
# upgrade first to avoid fixable vulnerabilities end
2121

2222
# Install useful OS packages
23-
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
23+
# remove skopeo, CVE-2025-4674
24+
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum
2425

2526
# Other apps and tools installed as default user
2627
USER 1001
2728

28-
# Install the oc client begin
29-
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
30-
-o /tmp/openshift-client-linux.tar.gz && \
31-
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
32-
rm -f /tmp/openshift-client-linux.tar.gz
33-
# Install the oc client end
34-
3529
WORKDIR /opt/app-root/src
3630

3731
################

scripts/dockerfile_fragments.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ def main():
3636
prefix="Install micropipenv and uv to deploy packages from requirements.txt",
3737
)
3838

39-
blockinfile(
40-
dockerfile,
41-
textwrap.dedent(r"""
42-
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
43-
-o /tmp/openshift-client-linux.tar.gz && \
44-
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
45-
rm -f /tmp/openshift-client-linux.tar.gz
46-
"""),
47-
prefix="Install the oc client",
48-
)
39+
if not is_rstudio(dockerfile):
40+
blockinfile(
41+
dockerfile,
42+
textwrap.dedent(r"""
43+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
44+
-o /tmp/openshift-client-linux.tar.gz && \
45+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
46+
rm -f /tmp/openshift-client-linux.tar.gz
47+
"""),
48+
prefix="Install the oc client",
49+
)
4950

5051
if is_jupyter(dockerfile):
5152
blockinfile(
@@ -106,6 +107,10 @@ def is_jupyter(filename: pathlib.Path) -> bool:
106107
return filename.is_relative_to(ROOT_DIR / "jupyter")
107108

108109

110+
def is_rstudio(filename: pathlib.Path) -> bool:
111+
return filename.is_relative_to(ROOT_DIR / "rstudio")
112+
113+
109114
if __name__ == "__main__":
110115
main()
111116

tests/containers/base_image_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def test_oc_command_runs_fake_fips(self, image: str, subtests: pytest_subtests.S
164164
"""Establishes a best-effort fake FIPS environment and attempts to execute `oc` binary in it.
165165
166166
Related issue: RHOAIENG-4350 In workbench the oc CLI tool cannot be used on FIPS enabled cluster"""
167+
if utils.is_rstudio_image(image):
168+
pytest.skip("oc command is not preinstalled in RStudio images.")
167169
with tempfile.TemporaryDirectory() as tmp_crypto:
168170
# Ubuntu does not even have /proc/sys/crypto directory, unless FIPS is activated and machine
169171
# is rebooted, see https://ubuntu.com/security/certifications/docs/fips-enablement

0 commit comments

Comments
 (0)