mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
The admission-webhook deny exempted any endpoint carrying k8s-app: konnectivity-agent, in any namespace. Because the rule disables default-deny, falling out of the deny is the entire access decision — so any pod anywhere could reach the webhook port by labelling itself, which is precisely the access the policy exists to remove. k8s-app is an ordinary pod label a workload sets on itself. Nothing in the platform constrains pod labels by admission, and Cilium keeps k8s-app identity-relevant (its label filter ships no default whitelist), so the forged label really does change the endpoint's identity rather than being filtered out. The namespace key is derived by Cilium from the pod's actual namespace and cannot be set by the workload. Splitting the deny in two keeps the carve-out and closes the hole: one selector for everything outside kube-system with no label condition at all, one for kube-system carrying the existing NotIn. Only the agent in its own namespace is exempt. Kamaji at the pinned 26.3.6-edge puts nothing but k8s-app: konnectivity-agent on the agent pod template (internal/resources/konnectivity/agent.go), so the label remains the only available discriminator and the namespace confinement is what makes it safe to key on. Tests cover both halves: the outside-kube-system selector must carry no label condition, and the kube-system selector must keep exactly the namespace and label pair. Reported-by: Daniil Myasnikov <myasnikovdaniil2001@gmail.com> Assisted-By: Claude Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>