@@ -36,6 +36,29 @@ func getSecuritySpec(metadata types.Metadata, namespace string, spec v1.PodSpec,
3636		MountHostPaths : getVolumeHostPaths (spec ),
3737	}
3838
39+ 	for  _ , container  :=  range  spec .InitContainers  {
40+ 		addCapList , dropCapList  :=  getCapabilities (container .SecurityContext )
41+ 		csc  :=  types.ContainerSecuritySpec {
42+ 			Metadata :                 metadata ,
43+ 			ContainerName :            container .Name ,
44+ 			ImageName :                container .Image ,
45+ 			PodName :                  metadata .Name ,
46+ 			Namespace :                namespace ,
47+ 			HostName :                 spec .NodeName ,
48+ 			Capabilities :             getEffectiveCapablities (addCapList , dropCapList ),
49+ 			AddedCap :                 addCapList ,
50+ 			DroppedCap :               dropCapList ,
51+ 			ReadOnlyRootFS :           getReadOnlyRootFileSystem (container .SecurityContext ),
52+ 			RunAsNonRoot :             getRunAsNonRootUser (container .SecurityContext , spec .SecurityContext ),
53+ 			AllowPrivilegeEscalation : getAllowedPrivilegeEscalation (container .SecurityContext ),
54+ 			Privileged :               getPrivileged (container .SecurityContext ),
55+ 			RunAsGroup :               getRunAsGroup (container .SecurityContext , spec .SecurityContext ),
56+ 			RunAsUser :                getRunAsUser (container .SecurityContext , spec .SecurityContext ),
57+ 			HostPorts :                getHostPorts (container .Ports ),
58+ 		}
59+ 		cssList  =  append (cssList , csc )
60+ 	}
61+ 
3962	for  _ , container  :=  range  spec .Containers  {
4063		addCapList , dropCapList  :=  getCapabilities (container .SecurityContext )
4164		csc  :=  types.ContainerSecuritySpec {
@@ -337,6 +360,16 @@ func getVolumeHostPaths(spec v1.PodSpec) map[string]bool {
337360		}
338361	}
339362
363+ 	for  _ , c  :=  range  spec .InitContainers  {
364+ 		for  _ , vm  :=  range  c .VolumeMounts  {
365+ 			if  _ , exists  :=  containerMountMap [vm .Name ]; ! exists  {
366+ 				containerMountMap [vm .Name ] =  vm .ReadOnly 
367+ 			} else  {
368+ 				containerMountMap [vm .Name ] =  containerMountMap [vm .Name ] &&  vm .ReadOnly 
369+ 			}
370+ 		}
371+ 	}
372+ 
340373	for  _ , v  :=  range  spec .Volumes  {
341374		if  v .HostPath  !=  nil  {
342375			if  _ , exists  :=  containerMountMap [v .Name ]; exists  {
0 commit comments