Rule Metadata

Last updated: 2024-01-15
🟠
Severity
HIGH
📦
Category
Supply Chain & Image Security
Version
v1.0.0
Downloads
1.2K
Author: Spotter Security Team
Created: 2024-01-10
Compliance:
CIS NIST

Always Pull Images Admission Control Plugin Not Set

The `AlwaysPullImages` admission controller should be enabled to ensure that images are always pulled from the registry, preventing the use of stale or compromised cached images.

YAML Configuration

rule.yaml YAML
apiVersion: rules.spotter.dev/v1alpha1
kind: SpotterRule
metadata:
  name: spotter-supply-004
  labels:
    severity: "high"
    category: "supply"
  annotations:
    rules.spotter.dev/title: "Always Pull Images Admission Control Plugin Not Set"
    rules.spotter.dev/version: "1.0.0"
    rules.spotter.dev/cwe: "CWE-829"
    rules.spotter.dev/description: "The `AlwaysPullImages` admission controller should be enabled to ensure that images are always pulled from the registry, preventing the use of stale or compromised cached images."
spec:
  match:
    resources:
      kubernetes:
        apiGroups:
          - ""
        versions:
          - v1
        kinds:
          - Pod
  cel: |
    has(object.spec.containers) && object.spec.containers.exists(c,
      (has(c.command) && c.command.exists(cmd, cmd == "kube-apiserver")) &&
      !(has(c.args) && c.args.exists(arg, arg.contains("--enable-admission-plugins=") && arg.contains("AlwaysPullImages"))) &&
      !(has(c.command) && c.command.exists(cmd, cmd.contains("--enable-admission-plugins=") && cmd.contains("AlwaysPullImages")))
    )
  remediation:
    manual: "Enable the `AlwaysPullImages` admission plugin in the kube-apiserver configuration."
  references:
    - title: "Kubernetes Admission Controllers"
      url: "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages"