Skip to main content

More Info:

The ImagePolicyWebhook admission controller can enforce image provenance so that only trusted, verified images are admitted to the cluster.

Risk Level

High

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Review current admission configuration for ImagePolicyWebhook
    • On any machine with kubectl access:
    • If you find a config file path (for example /etc/kubernetes/admission-config.yaml), inspect it:
    • Confirm whether there is a ImagePolicyWebhook plugin section configured; if not, the feature is not in use.
  2. Determine the desired image provenance mechanism and trust policy
    • Decide what constitutes a “trusted image” in your environment (e.g., signed by a particular key, coming from a specific registry/project, or verified by an external attestation service).
    • Choose or design the webhook backend that will enforce this policy (custom admission webhook service, in-cluster or external, or a supported third‑party image verification solution).
    • Document:
      • The verification method (signing/attestation technology).
      • The registries/namespaces allowed.
      • Failure policy (reject on verification error vs allow).
  3. Design or validate the ImagePolicyWebhook AdmissionConfiguration
    • Draft an AdmissionConfiguration manifest including the ImagePolicyWebhook plugin that points to your webhook backend and enforces your policy decisions. For example (adjust URLs, timeouts, and CABundle to your environment):
    • Ensure the referenced kubeconfig (or other connection method your Kubernetes version supports) exists and points to your policy webhook service.
    • Do not apply yet; validate it against Kubernetes version compatibility and your webhook implementation docs.
  4. Stage and test the webhook service and policy in a non‑production environment
    • Deploy the admission webhook service (if not already running) in a test or staging cluster using manifests:
    • Configure the apiserver in that environment to use your drafted AdmissionConfiguration and restart the apiserver as required by your distribution.
    • Test with sample workloads:
    • Confirm that untrusted images are rejected and trusted ones are admitted, and refine policy if behavior is not as intended.
  5. Promote the configuration to production and monitor
    • Copy the validated AdmissionConfiguration file and supporting artifacts (kubeconfig, CA certs) to the production control plane nodes, then update the kube-apiserver manifest (or equivalent) to reference it via the appropriate flag. This is done outside kubectl (host-level change) and will restart the apiserver.
    • After the apiserver restarts, verify that workloads using untrusted images are rejected and trusted images succeed:
    • Review apiserver and webhook logs for errors or excessive denials and adjust policy if needed.
  6. Document, periodically review, and re‑verify
    • Record: where the AdmissionConfiguration file lives, what the policy rules are, and who maintains the webhook service.
    • On a recurring basis, re‑check configuration and effectiveness:
    • Re-run functional tests (trusted vs untrusted images) after significant cluster or policy changes to ensure image provenance enforcement remains active.
What to look for (problem indicators)
  • No webhook configuration related to image policy or provenance (for example names not mentioning image-policy, imageprovenance, cosign, notary, policy, etc.).
  • This usually means no image provenance enforcement is configured at all.

What to look for (problem indicators)
  • webhooks[].rules do not include apiGroups: [""] and resources: ["pods"] or other workload types (deployments, replicasets, statefulsets, etc.) — then pod/image creation may bypass the policy.
  • failurePolicy is Ignore instead of Fail — unverified images may still be admitted.
  • sideEffects is unset or incorrect (should typically be None).
  • clientConfig.service points to a non‑existent namespace/service, or wrong path/port.
  • namespaceSelector or objectSelector exclude important namespaces (e.g., default application namespaces), leaving workloads unenforced.
  • No mention in annotations or configuration of trusted registries, signatures, or verification policy.

What to look for (problem indicators)
  • No mutating webhook that adjusts image references to a verified form (if your design expects this).
  • Any mutating webhook that weakens image references (e.g., stripping digests or pinning to :latest) instead of strengthening provenance.

What to look for (problem indicators)
  • No policy engine or image-verification service deployed at all.
  • Configuration (in ConfigMaps/Secrets) that does not reference trusted registries, keys, or signature verification settings.
  • Policy engine pods in CrashLoopBackOff or Error state, indicating admission requests may fail open depending on failurePolicy.

What to look for (problem indicators)
  • The “untrusted” pod is created and runs successfully; this strongly suggests image provenance is not enforced.
  • No admission webhook denial messages in the pod events (kubectl describe pod ...) for the untrusted image.
  • The “trusted” pod is rejected with provenance-related errors (misconfigured policy) or both pods are treated identically (no provenance enforcement).

What to look for (problem indicators)
  • No reference to ImagePolicyWebhook in --enable-admission-plugins if your design relies on the legacy built‑in ImagePolicyWebhook admission plugin (on self‑managed control planes).
  • For managed control planes (EKS/AKS/GKE/OKE), control plane flags are typically not visible; in that case, absence of any webhooks/configs as above is the main indicator.

All of the above commands only surface the current state. Any decision to introduce, tighten, or relax image provenance policies, and the exact implementation (ImagePolicyWebhook vs. external policy engines), requires human review against your organization’s threat model and Kubernetes documentation.