Why it matters
A Secret in an environment variable is visible to every process in the container, appears in crash dumps and is easily logged. Mounted files can be restricted and rotate without a restart.
How to fix it
Mount the Secret as a volume and read it from the file.
What TrustIvan reads
Read through the Kubernetes API with the read-only role TrustIvan's install creates.
Benchmark controls
- CIS Kubernetes Benchmark 1.9.0, control
5.4.1: Secrets are read as files rather than environment variables. Also checked for this control: Container has a credential written into its manifest - NSA/CISA Kubernetes Hardening Guidance 1.2, control
network.secrets: Secrets are handled safely by workloads. Also checked for this control: Container has a credential written into its manifest
Control numbers are the published ones; the titles are TrustIvan's own short descriptions. The benchmarks belong to their publishers, who do not endorse TrustIvan.
Related checks
- Container has no seccomp profile
KubernetesSeverity: Low
k8s.container.seccomp-unset - Container sets a custom SELinux user, role or type
KubernetesSeverity: Medium
k8s.container.selinux-custom - Container explicitly disables seccomp
KubernetesSeverity: Medium
k8s.container.seccomp-unconfined - Container mounts /proc unmasked
KubernetesSeverity: High
k8s.container.unmasked-proc - Container runs as root
KubernetesSeverity: Medium
k8s.container.runs-as-root - Container image comes from an untrusted registry
KubernetesSeverity: Medium
k8s.container.untrusted-registry
Terms: KSPM (Kubernetes security posture management), Kubernetes RBAC, NSA/CISA Kubernetes Hardening Guidance, CIS Benchmarks
All Kubernetes posture checks · The whole catalogue · How this works in TrustIvan · Documentation