kvevents: refuse a non-loopback global ZMQ socket without an explicit opt-in #4106
zmqEndpoint shipped in v1.0.0 on a Beta plugin, so I think the N+2 rule applies to the removal planned in #4105 - is next release a deliberate security exception? Also llm-d-benchmark's convert-guide patterns still set tcp://*:5557, so that needs moving too.
nit: discoverPods is already the default, so I think the message should say to drop zmqEndpoint and have the engines bind their own PUB socket.
The tokenizer README links this file as the complete sample for precise-prefix-cache-producer, so anyone copying it gets allowUntrustedPublishers: true along with the bind. Wonder if we could point that at a discoverPods config or call it e2e-only?
Agreed on N+2. This PR is the shim: zmqEndpoint keeps working with allowUntrustedPublishers: true and logs a deprecation notice at startup. I will update #4105 so removal is two releases after the release that carries this PR, not "next release", unless maintainers decide on a security exception.
One behavior change does land now and is deliberate: a shipped config that binds zmqEndpoint on a non-loopback address without the opt-in fails at startup with an error that names both fixes. A warning alone would leave any network peer able to write index entries under any pod's identity, which is the exposure this PR is for. If you would rather have a warning-only release first, say so and I will change it.
Good catch on llm-d-benchmark. Its convert-guide pattern (discoverPods: false, zmqEndpoint: "tcp://*:5557") would fail startup after this lands. I will open an issue there to move the pattern to per-pod subscriptions, which also drops the need for the opt-in.
Done. The startup error and the deprecation notice now say to drop zmqEndpoint and have each engine bind its own PUB socket, which the EPP subscribes to by default.
Done. The tokenizer README now points at test/perf/config/router-configs/precise-prefix.yaml as the deployment-shaped sample (per-pod subscriptions) and describes the e2e file as the simulator variant that binds a socket, with allowUntrustedPublishers called out as not a deployment setting. Both e2e bind configs also carry an "e2e only" header, since sim-epp-kvcache-config.yaml is linked from docs/metrics.md the same way.
Thanks - N+2 in #4105 works for me. I'd keep the hard fail here since the opt-in is one line, no need for a warning-only release.
Approved these changes.
vMaroon
ahg-g
What type of PR is this?
/kind bug
What this PR does / why we need it:
kvEventsConfig.zmqEndpointbinds one SUB socket that every engine publishes to. A bound socket cannot tell publishers apart, so the pod identity comes from the topic, and any peer that can reach the socket publishes KV events under any pod's identity. Per-pod subscriptions (discoverPods, the default and what every guide uses) attribute events to the dialed pod and do not have this problem.This PR is the first step of #4105:
kvevents.NewPoolrejects azmqEndpointthat binds a non-loopbacktcp://address unlesskvEventsConfig.allowUntrustedPublishersistrue.ipc://,inproc://, and loopbacktcp://binds stay allowed for single-host deployments. The error names the safe alternative and the opt-in.zmqEndpointis used.allowUntrustedPublishers: true, since their simulator pods publish to the EPP's bound socket. The integration test binds127.0.0.1and needs no change.Removal of the global socket mode, with the e2e overlays moved to pull mode, is the second step tracked in #4105.
zmqEndpointshipped in v1.0.0, so removal follows the N+2 deprecation policy: this PR is the shim and the startup notice, and the field is removed no earlier than two releases later. llm-d-benchmark'sconvert-guidepattern bindszmqEndpointtoo and is tracked separately.One behavior change lands with this PR: a shipped config that binds
zmqEndpointon a non-loopback address withoutallowUntrustedPublishersfails at startup with an error that names both fixes.Which issue(s) this PR fixes:
Part of #4105
Test plan:
NewPoolaccepts an empty endpoint, loopbacktcp://(IPv4,localhost,[::1]),ipc://, andinproc://, and rejects0.0.0.0,*,[::], a routable IP, a hostname, and a malformed endpoint, unless the opt-in is set.pkg/kveventsand precise-prefix-cache tests pass.Release note:
``
release-notekvEventsConfig.zmqEndpointThe EPP refuses to bind
on a non-loopback address unlesskvEventsConfig.allowUntrustedPublishersistrue, because the bound socket takes the pod identity from the topic.zmqEndpointis deprecated in favor of per-pod subscriptions (discoverPods).
``