Service Account Private Key File Not Defined

  • Query id: ccc98ff7-68a7-436e-9218-185cb0b0b780
  • Query name: Service Account Private Key File Not Defined
  • Platform: Kubernetes
  • Severity: Medium
  • Category: Encryption
  • CWE: 286
  • URL: Github

Description

When using kube-controller-manager commands, the '--service-account-private-key-file' should be defined
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0
      command: ["kube-controller-manager"]
      args: []
  restartPolicy: OnFailure

Code samples without security vulnerabilities

Negative test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0
      command: ["kube-controller-manager"]
      args: ["--service-account-private-key-file=/path/to/key/file.pem"]
  restartPolicy: OnFailure
Negative test num. 2 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0
      command: ["kube-controller-manager","--service-account-private-key-file=/path/to/key/file.pem"]
      args: []
  restartPolicy: OnFailure