You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gateway-wide CTP incorrectly accepted when Gateway name is a prefix of another Gateway name (mergeGateways) #9226
When mergeGateways is enabled and two Gateways exist where one name is a string prefix of the other (e.g. gw and gw-b), a Gateway-wide ClientTrafficPolicy targeting the shorter-named Gateway is incorrectly accepted even though a same-port HTTP listener exists on the other Gateway. The port overlap validation in validatePortOverlapForClientTrafficPolicy uses strings.Index(currName, prefix) == 0 to check whether a same-port listener belongs to the targeted Gateway, but because extractGatewayNameFromListener returns the prefix without a trailing slash, "envoy-gateway/gw" falsely matches "envoy-gateway/gw-b/http", causing the conflict to go undetected.
The same bug was identified and fixed for extractListenerSetPrefixFromListener in #9026 (trailing slash added to the returned prefix). The Gateway path has the same vulnerability.
Observe that the ClientTrafficPolicy status shows Accepted: True — it should show a port conflict error referencing the gw-b listener.
Environment:
Reproducible via the translation unit tests, no cluster required. The test fixture is at internal/gatewayapi/testdata/clienttrafficpolicy-gateway-wide-same-port-prefix-name-conflict.{in,out}.yaml.
Activity