Security Benchmarks
This page describes how the OCM container images and the controller Helm chart
perform against three widely used security benchmarks: the CIS Docker Benchmark,
the CIS Kubernetes Benchmark, and the NSA/CISA Kubernetes Hardening Guide. The
images are built FROM scratch with static binaries and a CA bundle; the
default CLI image and the controller image add a FIPS build of cosign. See
FIPS 140-3: Artifacts
for build details and
DISA STIG
for the GPOS SRG scan and container hardening measures.
OCM does not give compliance guarantees. Whether a deployment meets your requirements depends on your platform, configuration, and compliance regime.
Benchmarks Covered
| Benchmark | Version | Scope checked |
|---|---|---|
| CIS Docker Benchmark | v1.7.0 (July 2024, Docker 26.x) | Section 4 — Container images and build files |
| CIS Kubernetes Benchmark | v1.11.0 (April 2025, Kubernetes 1.31/1.32) | Section 5 — Policies (the parts a workload or chart controls) |
| NSA/CISA Kubernetes Hardening Guide | v1.2 (August 2022) | Pod security, RBAC, network, and supply-chain recommendations |
The CIS Docker Benchmark section 4 covers image-level controls: non-root user, trusted base images, no unnecessary packages, no secrets, HEALTHCHECK, and content trust. The CIS Kubernetes Benchmark section 5 covers workload-level policies: pod security, RBAC, network policies, and secrets. The NSA/CISA guide covers similar areas from a threat-model perspective.
Sections 1–3 of the CIS Docker Benchmark (host, daemon, and daemon configuration files) and sections 1–4 of the CIS Kubernetes Benchmark (control plane, etcd, and worker nodes) are the platform operator’s responsibility.
Scan Tools
Every build and release pipeline run scans the images and the chart with three
open-source scanners, in the reusable Image scan workflow
(.github/workflows/image-scan.yml). The scans block publishing, like the
DISA STIG
scan:
| Tool | What it checks | Runs on | Fails on |
|---|---|---|---|
| dockle | CIS Docker Benchmark section 4 | Each image and architecture | Any WARN or FATAL check |
Trivy config | CIS Kubernetes Benchmark, the built-in Kubernetes and Dockerfile checks of Trivy, and OCM’s own checks | Rendered chart and the image build files | Any finding not in .github/benchmarks/trivyignore.yaml, or no manifests checked |
| Kubescape | NSA and MITRE ATT&CK frameworks | Rendered chart | Any failed control on a resource without an exception in .github/benchmarks/kubescape-exceptions.json, or no resources scanned |
The chart is rendered with helm template and
manager.networkPolicy.enabled=true. That render is the default render plus the
NetworkPolicy, so it covers every template a default installation gets. Each
template is written to its own file, so each accepted Trivy finding applies only
to the template that needs it. The scan job places the image build files
(Containerfile, Dockerfile) next to the rendered chart under build/, so
Trivy checks them in the same run.
Every accepted finding is explained below. The dockle and Kubescape images are
pinned by digest in the root .env (DOCKLE_IMAGE, KUBESCAPE_IMAGE), Trivy by
TRIVY_VERSION with its checks bundle in TRIVY_CHECKS_IMAGE, and the Kubescape
framework definitions, which it downloads at scan time, by
KUBESCAPE_CONTROLS_VERSION (--controls-version). An upstream control change
therefore reaches the scan only when one of those pins is bumped.
Each image is also checked for the metadata that makes its function and history
traceable (.github/scripts/image-metadata.js): its platform manifest must carry
the OCI annotations title, description, version, revision, source,
created, vendor and licenses, and a SLSA provenance attestation.
Results are in the job summary and in the image-scan-<image>-<arch> and
chart-scan workflow artifacts. The
BSI IT-Grundschutz
page maps all of these checks to BSI requirements.
CIS Docker Benchmark (Section 4)
All three images (CLI, slim CLI, controller) are scanned with dockle. They have
no shell, no package manager, no setuid/setgid files, no secrets, no ADD
instructions, and run as user 65532. dockle produces no WARN or FATAL
findings. Its two SKIP results (DKL-LI-0001, DKL-LI-0002) are checks
specific to dockle of /etc/passwd and /etc/shadow, which none of the images
contain:
| Check | Description | CLI image | Controller image | Notes |
|---|---|---|---|---|
| CIS-DI-0001 | Non-root user | ✅ | ✅ | USER 65532:65532 |
| CIS-DI-0002 | Trusted base images | ✅ | ✅ | scratch, with the CA bundle from the digest-pinned Garden Linux FIPS image and cosign from the digest-pinned OCM cosign image |
| CIS-DI-0003 | No unnecessary packages | ✅ | ✅ | Only the binary and CA bundle; the default CLI image and the controller image also have cosign |
| CIS-DI-0005 | Content trust | ℹ️ INFO | ℹ️ INFO | DOCKER_CONTENT_TRUST is a client-side setting, not an image property |
| CIS-DI-0006 | HEALTHCHECK instruction | ℹ️ INFO | ℹ️ INFO | Not applicable: on Kubernetes the chart sets liveness and readiness probes |
| CIS-DI-0007 | No bare update instructions | ✅ | ✅ | No package manager |
| CIS-DI-0008 | No setuid/setgid files | ✅ | ✅ | No files with elevated permissions |
| CIS-DI-0009 | COPY instead of ADD | ✅ | ✅ | Only COPY is used |
| CIS-DI-0010 | No secrets in Dockerfile | ✅ | ✅ | No secrets or credentials |
CIS-DI-0005 and CIS-DI-0006 are INFO-level observations, not failures. Content trust (CIS-DI-0005) is a Docker client environment variable that controls whether pulls verify signatures; it cannot be set inside an image. HEALTHCHECK (CIS-DI-0006) is superseded by Kubernetes probes when the image runs in a pod; the controller chart configures both liveness and readiness probes.
Reproducing with dockle
Build the CLI image (from bindings/go/cli):
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOFIPS140=certified \
go build -trimpath -o tmp/bin/ocm-linux-arm64 .
docker buildx build --platform linux/arm64 --load \
-t local/ocm-cli:bench -f Containerfile .
rm tmp/bin/ocm-linux-arm64Build the controller image (from bindings/go):
docker buildx build --platform linux/arm64 --load \
--build-arg GOFIPS140=certified \
-t local/ocm-controller:bench \
-f kubernetes/controller/Dockerfile .Scan either image with the dockle version CI uses (from the root .env):
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
"$(sed -n 's/^DOCKLE_IMAGE=//p' .env)" \
--exit-code 1 --exit-level warn local/ocm-cli:benchdockle’s CIS-DI-0001 check flags only images whose user is root by name. An
image built with a numeric USER 0 passes it. The chart’s runAsNonRoot: true
covers this on Kubernetes.
Clean up:
docker rmi local/ocm-cli:bench local/ocm-controller:benchCIS Kubernetes Benchmark (Section 5)
The rendered Helm chart and the image build files are scanned with Trivy
config. Every finding it reports is accepted for the listed file only. The
table below is rendered from .github/benchmarks/trivyignore.yaml, the same file
the CI scan uses:
| Check | File | Rationale |
|---|---|---|
| KSV-0041 | chart/templates/rbac/manager-role.yaml | The controller resolves OCI registry credentials from Kubernetes Secrets referenced in Repository and Resource custom resources. Read/list/watch on secrets is required for this. The ClusterRole does not grant create, update, or delete on secrets; OCM-KSV-0003 fails the scan if any role does. |
| OCM-KSV-0004 | chart/templates/rbac/namespaceddeployer-impersonation-role.yaml | The NamespacedDeployer applies and prunes resources as the service account named in its spec, so the controller impersonates service accounts cluster-wide. This is the chart's widest grant, letting the controller act as any service account, including ones that may write Secrets, which OCM-KSV-0003 forbids for the controller's own roles. Disable it with manager.namespacedDeployer.enabled=false. No other role may grant impersonation. |
All other checks pass. The pod spec sets runAsNonRoot: true,
runAsUser/runAsGroup: 65532, allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true, drops all capabilities, and uses
seccompProfile: RuntimeDefault. These settings satisfy the CIS Kubernetes
Benchmark section 5.2 (Pod Security Standards) controls.
Trivy also runs OCM’s own checks from .github/trivy-checks, for
requirements no built-in check covers:
| Check | Runs on | Requires |
|---|---|---|
OCM-KSV-0001 | Rendered chart | Every container image is pinned by digest |
OCM-KSV-0002 | Rendered chart | Every container has a liveness and a readiness probe |
OCM-DS-0001 | Image build files | Every base image is scratch, an earlier build stage, or pinned by digest |
Reproducing with Trivy
The Helm renderer built into Trivy assumes Kubernetes 1.20, which the chart’s
kubeVersion: ">=1.26.0-0" rejects, so Trivy would scan nothing. Render the
chart first, as CI does. Docker Desktop on macOS does not share the worktree
path, so copy the rendered templates into a Docker volume:
cd <repository-root>
helm template ocm-k8s-toolkit bindings/go/kubernetes/controller/chart \
--namespace ocm-k8s-toolkit-system --kube-version 1.35.1 \
--set manager.networkPolicy.enabled=true \
--output-dir /tmp/ocm-bench/rendered
mkdir -p /tmp/ocm-bench/rendered/build/cli /tmp/ocm-bench/rendered/build/controller
install -m 0644 bindings/go/cli/Containerfile /tmp/ocm-bench/rendered/build/cli/Containerfile
install -m 0644 bindings/go/kubernetes/controller/Dockerfile /tmp/ocm-bench/rendered/build/controller/Dockerfile
cp -R .github/benchmarks .github/trivy-checks /tmp/ocm-bench/
# BSD tar (macOS) needs --no-mac-metadata; GNU tar (Linux) does not have it.
tar_opts=()
if [[ "$(uname -s)" == Darwin ]]; then tar_opts+=(--no-mac-metadata); fi
tar cf - ${tar_opts[@]+"${tar_opts[@]}"} -C /tmp/ocm-bench . \
| docker run --rm -i -v ocm-bench:/data alpine:latest sh -c 'cd /data && tar xf - && chown -R 1001 /data'
docker run --rm -v ocm-bench:/data -w /data \
"aquasec/trivy:$(sed -n 's/^TRIVY_VERSION=v//p' .env)" \
config --ignorefile benchmarks/trivyignore.yaml \
--checks-bundle-repository "$(sed -n 's/^TRIVY_CHECKS_IMAGE=//p' .env)" \
--config-check trivy-checks --check-namespaces user \
--config-data benchmarks/trivy-data renderedOmit --ignorefile to see the accepted findings, or add
--include-non-failures to see every passing check.
NSA/CISA Kubernetes Hardening Guide
The chart, rendered with the NetworkPolicy enabled, is scanned with Kubescape
against the NSA and MITRE ATT&CK frameworks. Every control that still fails has
an exception. The table below is rendered from
.github/benchmarks/kubescape-exceptions.json, the same file the CI scan uses.
The compliance scores of each run are in the job summary of the
Image scan / chart job.
With default values (manager.networkPolicy.enabled=false), no NetworkPolicy is
rendered, so C-0030 (Ingress and Egress blocked) also fails. The policy is
opt-in because it needs a CNI that enforces NetworkPolicy. When enabled, it
allows ingress to the health-probe port (and the metrics port when metrics are
enabled) and egress to DNS (53) and HTTPS/Kubernetes API (443, 6443); replace
the egress rules with manager.networkPolicy.egress, add ingress rules with
manager.networkPolicy.ingress.
| Control(s) | Resources | Rationale |
|---|---|---|
| C-0015 | ServiceAccount/ocm-k8s-toolkit-controller-manager | The controller resolves OCI registry credentials from Secrets referenced in Repository and Resource custom resources, so its ClusterRole needs get/list/watch on Secrets. It does not grant create, update, or delete. |
| C-0034, C-0053 | ServiceAccount/ocm-k8s-toolkit-controller-manager, Deployment/ocm-k8s-toolkit-controller-manager | The controller authenticates to the Kubernetes API with its service account token, so the token is mounted (C-0034) and the service account has RBAC bindings (C-0053 reports every bound service account). Mounting the token explicitly with automount disabled only moves the finding to Trivy KSV-0036. Among those bindings is the NamespacedDeployer impersonation ClusterRole; the pinned nsa/mitre frameworks do not evaluate C-0065 (No impersonation), so OCM-KSV-0004 reports that grant instead and accepts it only for that one template. |
All other controls pass, including: no privileged containers, no host PID/IPC/network, no hostPath mounts, no insecure capabilities, non-root execution, read-only filesystem, CPU and memory limits set, immutable container filesystem, and no privilege escalation.
Reproducing with Kubescape
With the rendered templates in the ocm-bench volume (see
Reproducing with Trivy):
docker run --rm --user 1001 -e HOME=/tmp -v ocm-bench:/data -w /data \
"$(sed -n 's/^KUBESCAPE_IMAGE=//p' .env)" \
scan framework nsa,mitre rendered \
--controls-version "$(sed -n 's/^KUBESCAPE_CONTROLS_VERSION=//p' .env)" \
--exceptions benchmarks/kubescape-exceptions.jsonKubescape lists excepted controls as failed, marked w/exceptions. Omit
--exceptions to see them without the marker, or add -v for per-resource
details. Clean up:
docker volume rm ocm-bench
rm -r /tmp/ocm-benchSummary
No benchmark finding is open: all three scans block publishing, so every release
passes them. The accepted findings come from what the controller needs to work
(reading registry credentials from Secrets, leader election, Kubernetes API
access) and from a registry allowlist that depends on your environment. Each is
listed with its rationale above. Without the opt-in NetworkPolicy, C-0030 fails
as well.
Image-level checks (CIS-DI-0005, CIS-DI-0006) are informational and not applicable in a Kubernetes deployment.