mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-01-31 07:43:27 +08:00
47 lines
1.8 KiB
YAML
47 lines
1.8 KiB
YAML
id: k8s-liveness-probe-not-configured
|
|
|
|
info:
|
|
name: Liveness Probe Not Configured in Deployments
|
|
author: princechaddha
|
|
severity: medium
|
|
description: Checks for missing liveness probes in Kubernetes Deployments, which are essential for managing container health and automatic recovery
|
|
impact: |
|
|
Absence of liveness probes can lead to unresponsive containers remaining in service, potentially degrading application performance and availability.
|
|
remediation: Configure liveness probes for all containers in Kubernetes Deployments to ensure proper health checks and automatic restarts of failing containers
|
|
reference:
|
|
- https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
|
|
tags: cloud,devops,kubernetes,k8s,devsecops,deployments,k8s-cluster-security
|
|
|
|
flow: |
|
|
code(1);
|
|
for (let deployment of template.items) {
|
|
set("deployment",deployment)
|
|
javascript(1);
|
|
}
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: kubectl get deployments --all-namespaces --output=json
|
|
extractors:
|
|
- type: json
|
|
name: items
|
|
internal: true
|
|
json:
|
|
- '.items[]'
|
|
|
|
javascript:
|
|
- code: |
|
|
deployment = JSON.parse(template.deployment);
|
|
if (!deployment.spec.template.spec.containers.some(container => container.livenessProbe)) {
|
|
let result = (`Deployment '${deployment.metadata.name}' in namespace '${deployment.metadata.namespace}' lacks a configured liveness probe.`);
|
|
Export(result);
|
|
}
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- response
|
|
# digest: 490a0046304402200d2e45e711a22fa4ab57ff3065de5eb87f78aa2904b41e829e3566b04de8109e02206750a88213ad16e78ffaf03980b9b7a6994acb71bdebaf83292d6608fa07a130:366f2a24c8eb519f6968bd8801c08ebe |