Authorization Mode Set To Always Allow
- Query id: f1f4d8da-1ac4-47d0-b1aa-91e69d33f7d5
- Query name: Authorization Mode Set To Always Allow
- Platform: Kubernetes
- Severity: Medium
- Category: Access Control
- URL: Github
Description¶
When using the kubelet command, the authorization-mode flag should not have 'AlwaysAllow' mode
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:
["--anonymous-auth=false", "--authorization-mode=MyMode,AlwaysAllow"]
restartPolicy: OnFailure
Positive 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-apiserver-amd64:v1.6.0
command: ["kube-apiserver", "--authorization-mode=MyMode,AlwaysAllow"]
restartPolicy: OnFailure
Positive test num. 3 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: foo/bar
command: ["kubelet"]
args:
["--anonymous-auth=false", "--authorization-mode=MyMode,AlwaysAllow"]
restartPolicy: OnFailure
Positive test num. 4 - yaml file
Positive test num. 5 - yaml file
Positive test num. 6 - json file
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: ["--authorization-mode=MyMode"]
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-apiserver-amd64:v1.6.0
command: ["kube-apiserver", "--authorization-mode=MyMode"]
restartPolicy: OnFailure
Negative test num. 3 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: foo/bar
command: ["kubelet"]
args: ["--authorization-mode=MyMode"]
restartPolicy: OnFailure