Service Account Key File Not Properly Set

  • Query id: dab4ec72-ce2e-4732-b7c3-1757dcce01a1
  • Query name: Service Account Key File Not Properly Set
  • Platform: Kubernetes
  • Severity: Medium
  • Category: Secret Management
  • URL: Github

Description

When using kube-apiserver command, the '--service-account-key-file' flag 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-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      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-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: ["--service-account-key-file=/path/to/file.pem"]
  restartPolicy: OnFailure