Repository: cdk8s-team/cdk8s-plus
Pull request #1094 (2022-09-02 23:34:06)

feat(container): default container UID and GID
We need to set a number bigger than 9999 for UID and GID of the container. This helps preventing the container to get access to host files even if it somehow gets access to the host's file system. 

Resolves https://github.com/cdk8s-team/cdk8s-plus/issues/810

Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>


Patch:
diff --git a/src/container.ts b/src/container.ts
index e2ddaf94..6576ecf5 100644
--- a/src/container.ts
+++ b/src/container.ts
@@ -15,14 +15,18 @@ export interface ContainerSecurityContextProps {
   /**
     * The UID to run the entrypoint of the container process.
     *
-    * @default - User specified in image metadata
+    * @default - 25000. An arbitrary number bigger than 9999 is selected here.
+    * This is so that the container is blocked to access host files even if
+    * somehow it manages to get access to host file system.
     */
   readonly user?: number;
 
   /**
     * The GID to run the entrypoint of the container process.
     *
-    * @default - Group configured by container runtime
+    * @default - 26000. An arbitrary number bigger than 9999 is selected here.
+    * This is so that the container is blocked to access host files even if
+    * somehow it manages to get access to host file system.
     */
   readonly group?: number;
 
@@ -66,8 +70,8 @@ export class ContainerSecurityContext {
     this.ensureNonRoot = props.ensureNonRoot ?? false;
     this.privileged = props.privileged ?? false;
     this.readOnlyRootFilesystem = props.readOnlyRootFilesystem ?? false;
-    this.user = props.user;
-    this.group = props.group;
+    this.user = props.user ?? 25000;
+    this.group = props.group ?? 26000;
   }
 
   /**


Test patch:
diff --git a/test/__snapshots__/container.test.ts.snap b/test/__snapshots__/container.test.ts.snap
index d7c1390e..631338b9 100644
--- a/test/__snapshots__/container.test.ts.snap
+++ b/test/__snapshots__/container.test.ts.snap
@@ -31,7 +31,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
           "volumeMounts": Array [
             Object {
diff --git a/test/__snapshots__/daemon-set.test.ts.snap b/test/__snapshots__/daemon-set.test.ts.snap
index 7aedf140..2a1729e8 100644
--- a/test/__snapshots__/daemon-set.test.ts.snap
+++ b/test/__snapshots__/daemon-set.test.ts.snap
@@ -41,7 +41,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -99,7 +101,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
diff --git a/test/__snapshots__/deployment.test.ts.snap b/test/__snapshots__/deployment.test.ts.snap
index a3543098..2c6ef51e 100644
--- a/test/__snapshots__/deployment.test.ts.snap
+++ b/test/__snapshots__/deployment.test.ts.snap
@@ -55,7 +55,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -177,7 +179,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -265,7 +269,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -353,7 +359,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -439,7 +447,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -506,7 +516,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -585,7 +597,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -652,7 +666,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -728,7 +744,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -817,7 +835,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -903,7 +923,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -970,7 +992,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1049,7 +1073,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1116,7 +1142,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1192,7 +1220,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1281,7 +1311,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1367,7 +1399,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1451,7 +1485,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1532,7 +1568,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1580,7 +1618,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
diff --git a/test/__snapshots__/network-policy.test.ts.snap b/test/__snapshots__/network-policy.test.ts.snap
index 36101507..692c3c7a 100644
--- a/test/__snapshots__/network-policy.test.ts.snap
+++ b/test/__snapshots__/network-policy.test.ts.snap
@@ -123,7 +123,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -164,7 +166,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -246,7 +250,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -306,7 +312,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -390,7 +398,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -469,7 +479,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -547,7 +559,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -630,7 +644,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -721,7 +737,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -808,7 +826,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -909,7 +929,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -991,7 +1013,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1074,7 +1098,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1115,7 +1141,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1197,7 +1225,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1257,7 +1287,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1341,7 +1373,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1420,7 +1454,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1498,7 +1534,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1581,7 +1619,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1672,7 +1712,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1759,7 +1801,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1860,7 +1904,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1942,7 +1988,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2025,7 +2073,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2104,7 +2154,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
diff --git a/test/__snapshots__/pod.test.ts.snap b/test/__snapshots__/pod.test.ts.snap
index 5b1f7962..b9540be6 100644
--- a/test/__snapshots__/pod.test.ts.snap
+++ b/test/__snapshots__/pod.test.ts.snap
@@ -55,7 +55,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -163,7 +165,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -209,7 +213,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -281,7 +287,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -327,7 +335,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -399,7 +409,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -445,7 +457,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -563,7 +577,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -609,7 +625,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -681,7 +699,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -727,7 +747,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -799,7 +821,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -845,7 +869,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -945,7 +971,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1020,7 +1048,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1134,7 +1164,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1237,7 +1269,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1283,7 +1317,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1405,7 +1441,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -1453,7 +1491,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1618,7 +1658,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1659,7 +1701,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1705,7 +1749,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1812,7 +1858,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1928,7 +1976,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -1974,7 +2024,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2132,7 +2184,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2240,7 +2294,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2340,7 +2396,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2415,7 +2473,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2529,7 +2589,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2642,7 +2704,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2688,7 +2752,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -2810,7 +2876,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -2858,7 +2926,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3023,7 +3093,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3064,7 +3136,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3110,7 +3184,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3217,7 +3293,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3333,7 +3411,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3379,7 +3459,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3537,7 +3619,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3645,7 +3729,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3691,7 +3777,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3781,7 +3869,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3879,7 +3969,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -3969,7 +4061,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4054,7 +4148,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4100,7 +4196,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4204,7 +4302,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
@@ -4362,7 +4462,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4429,7 +4531,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4494,7 +4598,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4540,7 +4646,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4598,7 +4706,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4644,7 +4754,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4699,7 +4811,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4762,7 +4876,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4823,7 +4939,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4869,7 +4987,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4927,7 +5047,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -4973,7 +5095,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -5028,7 +5152,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -5091,7 +5217,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -5159,7 +5287,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
@@ -5205,7 +5335,9 @@ Array [
           "securityContext": Object {
             "privileged": false,
             "readOnlyRootFilesystem": false,
+            "runAsGroup": 26000,
             "runAsNonRoot": false,
+            "runAsUser": 25000,
           },
         },
       ],
diff --git a/test/__snapshots__/service.test.ts.snap b/test/__snapshots__/service.test.ts.snap
index 7e31e7f0..038c478c 100644
--- a/test/__snapshots__/service.test.ts.snap
+++ b/test/__snapshots__/service.test.ts.snap
@@ -82,7 +82,9 @@ Array [
               "securityContext": Object {
                 "privileged": false,
                 "readOnlyRootFilesystem": false,
+                "runAsGroup": 26000,
                 "runAsNonRoot": false,
+                "runAsUser": 25000,
               },
             },
           ],
diff --git a/test/container.test.ts b/test/container.test.ts
index 68d6d750..b29aaf28 100644
--- a/test/container.test.ts
+++ b/test/container.test.ts
@@ -194,6 +194,8 @@ describe('Container', () => {
         privileged: false,
         readOnlyRootFilesystem: false,
         runAsNonRoot: false,
+        runAsUser: 25000,
+        runAsGroup: 26000,
       },
     };
 
@@ -545,8 +547,6 @@ test('default security context', () => {
   expect(container.securityContext.ensureNonRoot).toBeFalsy();
   expect(container.securityContext.privileged).toBeFalsy();
   expect(container.securityContext.readOnlyRootFilesystem).toBeFalsy();
-  expect(container.securityContext.user).toBeUndefined();
-  expect(container.securityContext.group).toBeUndefined();
 
   expect(container._toKube().securityContext).toEqual(container.securityContext._toKube());
   expect(container.securityContext._toKube()).toStrictEqual({