{"slug": "helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards", "title": "Helm Chart values.yaml Privilege Auditing & Kubernetes Pod Security Standards Without Cloud Uploads", "summary": "A developer published a zero-dependency Python auditor that scans Helm values.yaml files for privilege-escalation and Pod Security Standards violations before cluster admission, without uploading manifests to external scanners. The script uses standard-library regex checks to flag privileged containers, host namespaces, privilege escalation, hostPath mounts, root users, and mutable latest tags, scoring posture from 0 to 100. Tested against an insecure values file it returned a score of 0 and grade F with 8 findings, while a hardened snippet scored 100 and grade A+ with zero bytes uploaded.", "body_md": "Kubernetes workloads routinely reach production through Helm charts whose defaults look harmless until `helm template` renders `privileged: true`, host namespaces, or `:latest` image tags across dozens of templates. Checking security posture *before* cluster admission catches privilege escalation in local CI without uploading proprietary manifests to external SaaS scanners.\n\nIn this guide, we implement a zero-dependency Python Helm `values.yaml` auditor (`audit_helm_chart_values_security`) and pair it with the live [` audit_kubernetes_pod_security_baseline`](https://nandai.org/api/mcp) tool (`#107` in the `108`-tool stateless MCP registry documented at [` https://nandai.org/stacks/appsec-devsecops-eu-cra-release-stack`](https://nandai.org/stacks/appsec-devsecops-eu-cra-release-stack)).\n\n`audit_helm_chart_values_security` Auditor\nHelm `values.yaml` files encode security defaults that downstream templates inherit (`securityContext`, `podSecurityContext`, `hostNetwork`, `resources.limits`, and image tags). Running deterministic regex and structural checks in Python standard library flags high-risk overrides in milliseconds with zero PyPI packages:\n\n``` bash\n#!/usr/bin/env python3\n\"\"\"Zero-dependency Helm values.yaml privilege & PSS Restricted auditor.\"\"\"\nimport json\nimport re\n\ndef audit_helm_chart_values_security(values_yaml: str) -> dict:\n    if not values_yaml or not values_yaml.strip():\n        return {\"valid\": False, \"score\": 0, \"grade\": \"F\", \"findings\": [\"EMPTY_VALUES\"]}\n\n    findings = []\n    score = 100\n    checks = [\n        (\"HELM_PRIVILEGED_CONTAINER\", \"CRITICAL\", 30, r\"(?im)^\\s*privileged\\s*:\\s*true\\b\"),\n        (\"HELM_HOST_NAMESPACE\", \"CRITICAL\", 25, r\"(?im)^\\s*(hostNetwork|hostPID|hostIPC)\\s*:\\s*true\\b\"),\n        (\"HELM_PRIVILEGE_ESCALATION\", \"HIGH\", 20, r\"(?im)^\\s*allowPrivilegeEscalation\\s*:\\s*true\\b\"),\n        (\"HELM_HOST_PATH_MOUNT\", \"HIGH\", 15, r\"(?im)^\\s*hostPath\\s*:\"),\n        (\"HELM_ROOT_USER\", \"HIGH\", 15, r\"(?im)^\\s*(runAsNonRoot\\s*:\\s*false|runAsUser\\s*:\\s*0)\\b\"),\n        (\"HELM_MUTABLE_LATEST_TAG\", \"MEDIUM\", 10, r\"(?im)^\\s*tag\\s*:\\s*[\\\"']?latest[\\\"']?\\s*$\"),\n    ]\n    for fid, sev, pen, pat in checks:\n        if re.search(pat, values_yaml):\n            score -= pen\n            findings.append({\"id\": fid, \"severity\": sev, \"penalty\": pen})\n\n    if not re.search(r\"(?im)readOnlyRootFilesystem\\s*:\\s*true\\b\", values_yaml):\n        score -= 10\n        findings.append({\"id\": \"HELM_WRITABLE_ROOTFS\", \"severity\": \"MEDIUM\", \"penalty\": 10})\n    if not re.search(r\"(?im)type\\s*:\\s*RuntimeDefault\\b\", values_yaml):\n        score -= 10\n        findings.append({\"id\": \"HELM_MISSING_SECCOMP\", \"severity\": \"MEDIUM\", \"penalty\": 10})\n    if not re.search(r\"(?im)^\\s*limits\\s*:\", values_yaml):\n        score -= 10\n        findings.append({\"id\": \"HELM_MISSING_RESOURCE_LIMITS\", \"severity\": \"LOW\", \"penalty\": 10})\n\n    score = max(0, score)\n    grade = \"A+\" if score >= 95 else (\"A\" if score >= 85 else (\"C\" if score >= 60 else \"F\"))\n    return {\"valid\": score >= 80, \"score\": score, \"grade\": grade, \"findings\": findings, \"bytes_uploaded\": 0}\n\nif __name__ == \"__main__\":\n    hardened = \"\"\"image:\n  tag: \"2.0.0@sha256:05f9b8a6\"\npodSecurityContext:\n  runAsNonRoot: true\n  seccompProfile:\n    type: RuntimeDefault\nsecurityContext:\n  allowPrivilegeEscalation: false\n  readOnlyRootFilesystem: true\nresources:\n  limits:\n    cpu: 500m\n    memory: 512Mi\n\"\"\"\n    print(json.dumps(audit_helm_chart_values_security(hardened), indent=2))\n```\n\nTested locally against an insecure `values.yaml` (`privileged: true`, `hostNetwork: true`, `allowPrivilegeEscalation: true`, `runAsNonRoot: false`, `tag: latest`), the auditor drops the posture to `score: 0`, `grade: \"F\"`, `valid: false` across `8` concrete findings. Against the hardened snippet above, it returns `score: 100`, `grade: \"A+\"`, `valid: true`, `bytes_uploaded: 0`.\n\n`#107`)\nBecause Helm `values.yaml` directives transform through Go templates into `Deployment`, `StatefulSet`, `DaemonSet`, `Job`, and `CronJob` objects, pipe `helm template` output into a rendered Kubernetes PSS Restricted auditor.\n\nThe live stateless JSON-RPC 2.0 endpoint at [`https://nandai.org/api/mcp`](https://nandai.org/api/mcp) exposes `108` read-only MIT tools (`OpenAPI 3.1.0` descriptor at [`https://nandai.org/api/mcp?format=openapi`](https://nandai.org/api/mcp?format=openapi)), including Tool `#107` (`audit_kubernetes_pod_security_baseline`):\n\n```\ncurl -sS -X POST https://nandai.org/api/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"audit_kubernetes_pod_security_baseline\",\n      \"arguments\": {\"sample\": true, \"profile\": \"restricted\"}\n    }\n  }'\n```\n\nLive execution returns `ok: true`, `profile: \"restricted\"`, `workloads_count: 1`, `privileged_containers_count: 0`, `host_namespaces_count: 0`, `host_path_mounts_count: 0`, `mutable_images_count: 0`, `score: 100`, `grade: \"A+\"`, and `bytes_uploaded: 0`.\n\nTo audit proprietary rendered charts strictly offline with zero network egress, clone the MIT repository from [`https://nandai.org/git/destiny.git/`](https://nandai.org/git/destiny.git/) or download the pinned tarball [`https://nandai.org/releases/destiny-verify-2.0.0.tar.gz`](https://nandai.org/releases/destiny-verify-2.0.0.tar.gz) (` 6,511,290` B, SHA-256 `05f9b8a62d2e2d7bd554c609fc4f18e59f171408aa0c6d75a17743b9c4a09763`) and run `cli/destiny-verify.sh k8s-pss` or `python3 mcp/destiny_mcp_server.py` over local `stdio`.\n\n| Control | Vulnerable Default | Hardened Restricted Target | \n|---|---|---|\n| Container Escalation | `allowPrivilegeEscalation: true` or omitted | `allowPrivilegeEscalation: false` +`capabilities.drop: [\"ALL\"]` | \n| Pod Identity & Sandbox | `runAsUser: 0` / missing`seccompProfile` | `runAsNonRoot: true` +`seccompProfile.type: RuntimeDefault` | \n| Host Isolation | `hostNetwork: true` /`hostPath:` volumes | `hostNetwork/hostPID/hostIPC: false` +`emptyDir` / CSI volumes | \n| Filesystem & Quotas | Writable `/` + unbounded CPU/RAM | `readOnlyRootFilesystem: true` + explicit`resources.limits` | \n| Image Provenance | `tag: latest` | Semantic tag pinned with immutable `@sha256:` digest | \n\n`108`-Tool Streamable HTTP MCP` https://nandai.org/api/mcp``3.1.0` Schema Descriptor (`111` Schemas)`https://nandai.org/api/mcp?format=openapi`` https://nandai.org/.well-known/openapi-rest-mcp-bridge-spec.json``https://nandai.org/security`` https://nandai.org/git/destiny.git/``https://doi.org/10.5281/zenodo.24642737`", "url": "https://wpnews.pro/news/helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards", "canonical_source": "https://dev.to/karanyadav97/helm-chart-valuesyaml-privilege-auditing-kubernetes-pod-security-standards-without-cloud-uploads-3nj", "published_at": "2026-11-30 11:36:43+00:00", "updated_at": "2026-11-30 11:45:06.490885+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "mlops"], "entities": ["Helm", "Kubernetes", "nandai.org"], "also_reported_by": [], "takeaway": "A standard-library regex auditor can catch privileged containers, host namespaces, privilege escalation, hostPath mounts, root users and latest tags in Helm values.yaml before admission, scoring an insecure file 0/F and a hardened one 100/A+ with no uploads.", "recommendation": {"advice": "Run a deterministic local scan of rendered Helm values for privileged, host namespace, privilege escalation, hostPath, root user and latest-tag patterns in CI before admission, keeping manifests off external scanners.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards", "markdown": "https://wpnews.pro/news/helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards.md", "text": "https://wpnews.pro/news/helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards.txt", "jsonld": "https://wpnews.pro/news/helm-chart-values-yaml-privilege-auditing-kubernetes-pod-security-standards.jsonld"}}