Bug 2023342 - SCC admission should take ephemeralContainers into account
Summary: SCC admission should take ephemeralContainers into account
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: apiserver-auth
Version: 4.10
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ---
: 4.10.0
Assignee: Standa Laznicka
QA Contact: Yash Tripathi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-15 13:13 UTC by Standa Laznicka
Modified: 2023-02-08 02:53 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-10 16:27:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift apiserver-library-go pull 74 0 None open Bug 2023342: scc admission: add ephemeralContainers to admission consideration 2021-11-15 13:14:42 UTC
Red Hat Issue Tracker OCPBUGS-7181 0 None None None 2023-02-08 02:53:34 UTC
Red Hat Product Errata RHSA-2022:0056 0 None None None 2022-03-10 16:27:59 UTC

Description Standa Laznicka 2021-11-15 13:13:40 UTC
Description of problem:
Upstream is turning ephemeralContainers on in kubernetes 1.23. SCC admission is currently unaware of that field which means that users could create privileged containers at will without required privileges.

Version-Release number of selected component (if applicable):
4.10

How reproducible:
100% (once we rebase on 1.23)

Steps to Reproduce:
1. create a pod with a privileged ephemeral container (https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/) as a user that's not allowed to create privileged containers

Actual results:
User is allowed to do 1.

Expected results:
User should not be allowed to do 1.

Additional info:

Comment 1 Xingxing Xia 2021-11-16 02:57:26 UTC
Yash, this needs add a QE test case. After fixed / verified, pls help add one test case for it (ask me to peer review) (and attach the test case in this bug then remove the keyword being added). Thanks

Comment 2 Standa Laznicka 2021-11-23 08:06:27 UTC
moving to post, we'll still have to bump this in o/k and wait for the rebase in order to be able to test it

Comment 3 Sergiusz Urbaniak 2021-11-26 07:25:27 UTC
I’m adding UpcomingSprint, because I was occupied by fixing bugs with higher priority/severity, developing new features with higher priority, or developing new features to improve stability at a macro level. I will revisit this bug next sprint.

Comment 4 Standa Laznicka 2022-01-17 09:37:58 UTC
The fixed apiserver-library-go was merged to o/k master as a part of https://github.com/openshift/kubernetes/pull/1087

Comment 6 Yash Tripathi 2022-01-19 08:11:41 UTC
Verified on 4.10.0-0.nightly-2022-01-17-223655
Steps:
Create a project and try to create a privileged ephemeral container with a user that is not allowed to create privileged containers
1. oc new-project <project>
2. oc create -f <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: ephemeral-demo
spec:
  containers:
  - image: k8s.gcr.io/pause:3.1
    imagePullPolicy: IfNotPresent
    name: ephemeral-demo
    resources: {}
    securityContext:
      capabilities:
        drop:
        - KILL
        - MKNOD
        - SETGID
        - SETUID
      runAsUser: 1000650000
  ephemeralContainers:
  - name: ephemeral-demo-debug
    image: busybox
    securityContext:
      privileged: true
EOF

Expected:
Unable to create container with error

provider "nonroot": Forbidden: not usable by user or serviceaccount, spec.ephemeralContainers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed

Found:
Unable to create container with error

provider "nonroot": Forbidden: not usable by user or serviceaccount, spec.ephemeralContainers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed

Comment 9 errata-xmlrpc 2022-03-10 16:27:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:0056


Note You need to log in before you can comment on or make changes to this bug.