Repository navigation
Closed
Labels
priority/p2-mediumPriority P2: standard workscope/k8sKubernetes commands, Helm charts, pods, services, and policiestype/bugType bug: the code does not do what it must
Milestone
Description
Problem
The devsecops review session 20261001-224227 (2026-10-02, a path review of the whole repository with local models) raised 563 findings. A triage of every finding against release/v0.2.25 (c279c18) judged 489 false. Each of the 3 defects below was confirmed with code evidence and then upheld by a second agent that tried to refute it. The severities are re-rated; the review's own ratings were inflated.
Overly Permissive External Ingress from 0.0.0.0/0 (k8s/monitoring/networkpolicy.yaml:18, MEDIUM, security)
- Defect: Ingress rule 2 (lines 18-47) lists two peers,
ipBlock: cidr: 0.0.0.0/0and kube-system/traefik, on ports 80, 3000, 8080-8082, 9090, 9100, 9400, 12345 and 4040. The finding's 'entire internet' framing is wrong: no monitoring Service is NodePort or LoadBalancer, and Traefik is ClusterIP behind the Access-gated tunnel. The defect is real anyway. The cluster's policy engine is kube-router (docs/SELF_IMPROVEMENT.md:250), which matches ipBlock CIDRs against pod source IPs. So 0.0.0.0/0 admits every pod in every namespace and voids the perimeter that comments 14-17 describe. The Traefik peer already covers the stated purpose. Exposed services: Prometheus on 9090 has no auth and runsweb.enable-remote-write-receiver(prometheus-values.yaml:8-9), so any pod can read or write series. Grafana on 3000 allows anonymous Viewer (grafana-values.yaml:32-34). Through its datasource proxy, any pod can … - Skeptic's ruling: Upheld. The finding's 'exposed to the entire internet' framing is wrong. Every monitoring Service is ClusterIP, as is Traefik (verified read-only on homelab-k3s), and no monitoring NodePort or LoadBalancer exists. The ipBlock peer still defeats the namespace perimeter for in-cluster sources. The cluster runs k3s v1.31.4 with the embedded kube-router policy controller. kube-router's evalIPBlockPeer (pkg/controllers/netpol/policy.go) turns
0.0.0.0/0into ipset entries 0.0.0.0/1 and 128.0.0.0/1, … - Fix: In k8s/monitoring/networkpolicy.yaml rule 2, delete the
- ipBlock: {cidr: 0.0.0.0/0}peer and keep the kube-system/traefik peer. Rewrite the comment at line 17 ('Allow Traefik ingress to monitoring UIs and APIs'). Keep the ports: k8s/ingress/ingress-routes.yaml routes Traefik to grafana, prometheus, the alloy-* services, alloy-operator and kube-state-metrics. One caveat to check before landing:configure-urls --addressing proxy(k8s:// via src/devops_cli/k8s/service_proxy.py) connects from the API server's host netns on the control-plane node (hog). kube-router's local-node ACCEPT only covers pods on that node, and cross-node traffic leaves with hog's flannel.1 address. Today grafana and prometheus run on hog, so the proxy path works by placement only. Either document that, or add a narrow ipBlock for the control-plane node's pod-CIDR gateway address, never 0.0.0.0/0. Ship it with … - Regression test: In tests/test_k8s_network_policies.py, add test_monitoring_ingress_admits_no_world_cidr. It loads k8s/monitoring/networkpolicy.yaml and collects
[p['ipBlock']['cidr'] for r in spec['ingress'] for p in r.get('from', []) if 'ipBlock' in p]. It asserts no collected CIDR has prefix length 0, using ipaddress.ip_network(c).prefixlen == 0 so that 0.0.0.0/0 and ::/0 are both caught. It also asserts that some ingress rule has a kube-system/app.kubernetes.io/name=traefik peer with port 3000. It fails …
Insecure Security Context Configuration (k8s/llm/values-qdrant.yaml:44, LOW, config)
- Defect: The stated impact is wrong, but there is a real defect at the same lines. values-qdrant.yaml:44-49 sets
securityContext: {allowPrivilegeEscalation: false, readOnlyRootFilesystem: false, capabilities: {drop: [ALL]}}. The qdrant chart, installed unpinned (stack_lifecycle.py:123-128, so the latest is 1.19.1), never reads.Values.securityContext. Its container block is{{- with .Values.containerSecurityContext }} securityContext:(templates/statefulset.yaml:182-185). Its defaultcontainerSecurityContext(values.yaml:98-104) is runAsNonRoot true, runAsUser 1000, runAsGroup 2000, allowPrivilegeEscalation false, privileged false, readOnlyRootFilesystem true. So the effective root FS is already read-only, which disproves the finding's claim. The repo's whole hardening block is dead, though:capabilities.drop: [ALL]never reaches the pod and no seccompProfile is set. The container also … - Skeptic's ruling: Upheld, but only in the triage's reframed form. The original model claim is false and should be labelled a false positive in the feedback dataset. It said readOnlyRootFilesystem:false makes the root FS writable, but the effective root FS is read-only. Evidence:
helm pull qdrant/qdrant(1.19.1, the version installed unpinned by stack_lifecycle.py:123-128) reads only.Values.containerSecurityContext(templates/statefulset.yaml:182-183). Its default sets readOnlyRootFilesystem:true. `helm … - Fix: In k8s/llm/values-qdrant.yaml, replace the top-level
securityContext:withcontainerSecurityContext:. Set runAsNonRoot:true, runAsUser:1000, runAsGroup:1000 (to match podSecurityContext/fsGroup), allowPrivilegeEscalation:false, privileged:false, readOnlyRootFilesystem:true, capabilities.drop:[ALL] and seccompProfile.type:RuntimeDefault. The chart already mounts writable volumes at /qdrant/storage, /qdrant/snapshots and /qdrant/init, and Helm deep-merges with the chart defaults. Leave updateVolumeFsOwnership:false. Confirm the pod starts under RuntimeDefault seccomp afterdevops k8s deploy-stack --stack llm. Do not edit the historical CHANGELOG.md:652 line. Add a changelog.d/.md fragment for the fix instead. - Regression test: In tests/test_k8s_qdrant_security.py, change test_qdrant_helm_values_security to:
assert 'securityContext' not in data(the chart ignores it). Thencsc = data['containerSecurityContext']andassert (csc.get('readOnlyRootFilesystem'), csc.get('allowPrivilegeEscalation'), csc.get('capabilities', {}).get('drop'), csc.get('seccompProfile', {}).get('type'), csc.get('runAsGroup')) == (True, False, ['ALL'], 'RuntimeDefault', data['podSecurityContext']['runAsGroup']). It fails today because …
Hardcoded Host IP in Endpoints Configuration (k8s/llm/ollama-host-service.yaml:22, LOW, quality)
- Defect: The security framing (topology exposure) is wrong: 192.168.49.1 is minikube's documented bridge default. The real defect is that the file is dead legacy config. k8s/llm/kustomization.yaml:3-18 does not list it, and
grep -rn ollama-host-servicefinds no reference in src, docs, tests or k8s; the last change was v0.2.5 (e2b146a). Nothing addresses a Service namedollama: gateway, Open WebUI (values-open-webui.yaml:20-22) and devcontainer target the in-clusterollama-<n>gibtier Services (profiles/services.yaml) that replaced the host bridge. It also puts an RFC 1918 address in a k8s/ manifest, which AGENTS.md:30 forbids. test_zero_homelab_ip_or_hostname_leakage (tests/test_k8s_llm_gateway.py:388-411) scans only the gateway/ and profiles/ directories, so CI misses it. A related leftover of the same single-ollamaera: Portkey's egress selectorapp.kubernetes.io/name: ollama… - Skeptic's ruling: Upheld as a LOW quality finding: the manifest is a leftover that nothing deploys. The original HIGH security framing is refuted. 192.168.49.1 is minikube's publicly documented host-gateway default, not homelab topology, and the file is a static manifest with no untrusted input path. The same minikube range already appears in src/devops_cli/config/defaults.py:185. For that reason I don't rest the finding on the AGENTS.md:30 RFC 1918 rule either.
Why the orphan claim holds in the current …
- Fix: 1. Delete k8s/llm/ollama-host-service.yaml.
- Clean up the rest of the single-ollama era in the same change:
- Delete k8s/llm/values-ollama.yaml, its README.md:314 line and the test_k8s.py:1115 assertion.
- Retarget Portkey's Ollama egress rule to
llm.devops.io/provider: ollamaon port 11434, or drop it if Portkey is being retired. - Make networking.py's llm stack (
_configure_llm_stack_urlsand_collect_port_forward_services) target the gateway or tier Services instead ofsvc/ollama. - Replace gateway.py:195's hardcoded
ollama.llm.svc.cluster.localfallback with a configured or default tier URL. - Remove the stale SAN at tls_certificates.py:339.
- Coordinate with chore(ai): remove the code, config and policies left over from the removed vLLM deployments #820 and fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795 so those issues keep the vLLM and
ollama-volta-1lines. - Optionally widen test_zero_homelab_ip_or_hostname_leakage to cover all of k8s/llm/**/*.yaml.
- Regression test: Add test_llm_manifests_have_a_deploy_path to tests/test_k8s_llm_gateway.py. It reads files only. It collects every k8s/llm/**/*.yaml except kustomization.yaml and asserts that each one is listed under
resourcesin some k8s/llm kustomization.yaml (with directory entries expanded), or appears in stack_lifecycle._MANIFESTS_BY_STACK['llm'], or is thevaluesfile of a _HELM_RELEASES_BY_STACK['llm'] entry. Today it fails on ollama-host-service.yaml and values-ollama.yaml; it passes once both are …
Acceptance criteria
- Each defect above is fixed as its Fix line describes, or the PR says why another fix is better.
- Each has its Regression test: offline, failing on the base revision and passing after the fix.
- Removed code goes without shims (pre-1.0), and docs that described it are corrected.
uv run devops cipasses.
Key questions
- One PR for all of these? Yes (proposed). They share a module area and none needs a design decision; each fix is small.
Metadata
Metadata
Assignees
Labels
priority/p2-mediumPriority P2: standard workscope/k8sKubernetes commands, Helm charts, pods, services, and policiestype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(k8s): the monitoring perimeter admits no world cidr, qdrant runs …
dan-petty commentedon Oct 3, 2026
Closed by #1056, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)