Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): cover additional deprecated API versions in k8s rule #5867

Merged
merged 3 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "94b76ea5-e074-4ca2-8a03-c5a606e30645",
"queryName": "Object Is Using A Deprecated API Version",
"severity": "HIGH",
"category": "Insecure Configurations",
"descriptionText": "Check if any objects are using a deprecated version of API.",
"descriptionUrl": "https://kubernetes.io/docs/reference/using-api/deprecation-policy/",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "Kubernetes APIs evolve over time and are sometimes removed with newer releases. To prevent incompatibilities when upgrading Kubernetes, deprecated APIs should be replaced with newer and more stable API versions.",
"descriptionUrl": "https://kubernetes.io/docs/reference/using-api/deprecation-guide/",
"platform": "Kubernetes",
"descriptionID": "d5c30c5b"
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ CxPolicy[result] {
"Role": "rbac.authorization.k8s.io/v1",
"RoleBinding": "rbac.authorization.k8s.io/v1",
},
"batch/v1beta1": {
"CronJob": "batch/v1",
},
"policy/v1beta1": {
"PodDisruptionBudget": "policy/v1",
}
}

common_lib.valid_key(recommendedVersions[document.apiVersion], document.kind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,23 @@ spec:
name: test
port:
number: 80
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- date; echo Hello from kics
restartPolicy: OnFailure
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
[
{
"queryName": "Object Is Using A Deprecated API Version",
"severity": "HIGH",
"severity": "LOW",
"line": 1
},
{
"queryName": "Object Is Using A Deprecated API Version",
"severity": "HIGH",
"severity": "LOW",
"line": 23
},
{
"queryName": "Object Is Using A Deprecated API Version",
"severity": "HIGH",
"severity": "LOW",
"line": 58
},
{
"queryName": "Object Is Using A Deprecated API Version",
"severity": "HIGH",
"severity": "LOW",
"line": 76
},
{
"queryName": "Object Is Using A Deprecated API Version",
"severity": "LOW",
"line": 94
}
]