fixed lint error

patch-4
Prince Chaddha 2024-06-18 15:27:27 +04:00
parent 7ae624e9d8
commit 623251bba4
7 changed files with 10 additions and 10 deletions

View File

@ -37,7 +37,7 @@ javascript:
- code: |
deployment = JSON.parse(template.deployment);
deployment.spec.template.spec.containers.forEach(container => {
if (container.securityContext && container.securityContext.seccompProfile &&
if (container.securityContext && container.securityContext.seccompProfile &&
(container.securityContext.seccompProfile.type === 'RuntimeDefault' || container.securityContext.seccompProfile.type === 'DockerDefault')) {
// No action needed, configured properly
} else {

View File

@ -1,4 +1,4 @@
id: netpol-egress-rules
id: k8s-netpol-egress-rules
info:
name: Network policies define egress rules
@ -34,7 +34,7 @@ code:
javascript:
- code: |
let policyData = JSON.parse(template.policy);
let policyData = JSON.parse(template.policy);
if (!policyData.egress || policyData.egress.length === 0) {
let result = (`Network policy '${policyData.policy}' does not define egress rules.`);
Export(result);

View File

@ -1,4 +1,4 @@
id: k8s-ingress-rules
id: k8s-network-ingress-rules
info:
name: Define network ingress rules
@ -35,7 +35,7 @@ code:
javascript:
- code: |
let policyData = JSON.parse(template.policy);
let policyData = JSON.parse(template.policy);
if (!policyData.ingress || policyData.ingress.length === 0) {
let result = `Network policy '${policyData.policy}' does not define any ingress rules.`;
Export(result);

View File

@ -34,7 +34,7 @@ code:
javascript:
- code: |
let podData = JSON.parse(template.container);
let podData = JSON.parse(template.container);
podData.containers.forEach(container => {
if (container.securityContext && container.securityContext.allowPrivilegeEscalation === true) {
let result = (`Container '${container.name}' in pod '${podData.pod}' running with allowPrivilegeEscalation enabled.`);

View File

@ -35,7 +35,7 @@ code:
javascript:
- code: |
let podData = JSON.parse(template.pod);
let podData = JSON.parse(template.pod);
podData.containers.forEach(container => {
if (container.securityContext && container.securityContext.readOnlyRootFilesystem !== true) {
let result = (`Container '${container.name}' in pod '${podData.pod}' is not running with a read-only root filesystem.`);

View File

@ -34,7 +34,7 @@ code:
javascript:
- code: |
let podData = JSON.parse(template.pod);
let podData = JSON.parse(template.pod);
podData.containers.forEach(container => {
if (container.securityContext && container.securityContext.runAsUser === 0) {
let result = (`Container '${container.name}' in pod '${podData.pod}' is running with root user ID.`);

View File

@ -23,13 +23,13 @@ code:
- bash
source: |
kubectl get pods -n kube-system -l component=kube-apiserver -o jsonpath="{.items[*].spec.containers[*].command}"
matchers-condition: and
matchers:
- type: word
words:
- 'kube-apiserver'
- type: word
words:
- "service-account-issuer"