Repository navigation
fix(translator): stop seeding api_key_auth from the first keyed route - #10190
Merged
zhaohuabing merged 3 commits intoOct 10, 2026
Merged
Conversation
The listener-level api_key_auth filter is emitted disabled and switched on per route through typed_per_filter_config, but it was built from the first route on the listener that uses API key authentication. That publishes one route's credentials in the listener, so adding or rotating a key on that route rewrites the listener. Envoy then replaces the filter chain and drains the superseded one, terminating long-lived requests on every route of the listener. The same change on any other route is a route-only update that costs nothing, so which route pays is an artifact of ordering. Build the listener-level filter from an empty config instead. The per route configs are unchanged. Signed-off-by: John Lybeck <john.lybeck@amd.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: John Lybeck <john.lybeck@amd.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10190 +/- ##
==========================================
+ Coverage 81.51% 81.57% +0.06%
==========================================
Files 266 266
Lines 41407 41565 +158
==========================================
+ Hits 33753 33908 +155
- Misses 7653 7656 +3
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zhaohuabing
reviewed
Oct 8, 2026
zhaohuabing
previously approved these changes
Oct 8, 2026
zhaohuabing
left a comment
Member
There was a problem hiding this comment.
LGTM, with just a small nit on the release notes.
zirain
previously approved these changes
Oct 9, 2026
Signed-off-by: John Lybeck <john.lybeck@amd.com>
zirain
approved these changes
Oct 10, 2026
kkk777-7
pushed a commit
to kkk777-7/gateway
that referenced
this pull request
Oct 24, 2026
…envoyproxy#10190) * fix(translator): stop seeding api_key_auth from the first keyed route The listener-level api_key_auth filter is emitted disabled and switched on per route through typed_per_filter_config, but it was built from the first route on the listener that uses API key authentication. That publishes one route's credentials in the listener, so adding or rotating a key on that route rewrites the listener. Envoy then replaces the filter chain and drains the superseded one, terminating long-lived requests on every route of the listener. The same change on any other route is a route-only update that costs nothing, so which route pays is an artifact of ordering. Build the listener-level filter from an empty config instead. The per route configs are unchanged. Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: add release note for the api_key_auth listener fix Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: reword the api_key_auth release note per review Signed-off-by: John Lybeck <john.lybeck@amd.com> --------- Signed-off-by: John Lybeck <john.lybeck@amd.com>
kkk777-7
added a commit
that referenced
this pull request
Oct 24, 2026
* fix(infrastructure): mount writable /tmp on the shutdown-manager (#10120) * fix(infrastructure): mount writable /tmp on the shutdown-manager The shutdown-manager signals drain completion by creating /tmp/shutdown-ready. Since the fix for #4881, the controller replicates the user-provided Envoy container securityContext onto the shutdown-manager. When that securityContext sets readOnlyRootFilesystem: true, the shutdown-manager can no longer create the file, the Envoy preStop hook never gets a 200, the kubelet logs FailedPreStopHook, and both containers are SIGKILLed after the full grace period, making every proxy pod deletion take the full terminationGracePeriodSeconds instead of the drain duration. Mount a dedicated writable emptyDir at /tmp on the shutdown-manager (same approach as the writable wasm-cache emptyDir added for the control plane in #9069). The user's securityContext replication is preserved (custom runAsUser, capabilities, readOnlyRootFilesystem: true all keep working), so hardened deployments no longer break graceful shutdown. Fixes #10119 Signed-off-by: Clement Phu <clement.phu@hotmail.fr> * fix(shutdown-manager): clear stale shutdown ready marker at startup An emptyDir volume persists across container restarts within the same pod, so a /tmp/shutdown-ready marker created by a previous drain could short-circuit the next drain sequence. Remove the marker when the shutdown manager starts. Signed-off-by: Clement Phu <clement.phu@hotmail.fr> * fix(infrastructure): combine volume appends to satisfy gocritic Address the appendCombine lint failure reported by CI. Signed-off-by: Clement Phu <clement.phu@hotmail.fr> --------- Signed-off-by: Clement Phu <clement.phu@hotmail.fr> * fix(message): release discarded coalesced updates (#10144) * [envoy-gateway] Release discarded coalesced snapshots [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> * [envoy-gateway] Note coalesced update retention fix [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> --------- Signed-off-by: Cooper Gamble <cooper@openai.com> * fix(translator): use own route config name for TLS listeners sharing port with HTTP (#10171) * fix(translator): use own route config name for TLS listeners sharing a port with HTTP When an HTTP listener shares a container port with HTTPS listeners and is translated first, HTTPS virtual hosts ended up in its RouteConfiguration while their own filter chains referenced route configs that never existed. Default filter chain lookup only applies to plain HTTP listeners. Fixes #10170 Signed-off-by: stillya <st.ilya.101@gmail.com> * docs: add release note for #10171 Signed-off-by: stillya <st.ilya.101@gmail.com> --------- Signed-off-by: stillya <st.ilya.101@gmail.com> * fix: handle EndpointSlices labelled with both a Service and a ServiceImport (#10192) * fix: handle EndpointSlices labelled with both a Service and a ServiceImport Fixes #10191 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: Seiji Chew <seiji@exa.ai> * release-notes: use PR number for MCS EndpointSlice fix Signed-off-by: Seiji Chew <seiji@exa.ai> --------- Signed-off-by: Seiji Chew <seiji@exa.ai> Co-authored-by: Seiji Chew <seiji@exa.ai> * fix(translator): stop seeding api_key_auth from the first keyed route (#10190) * fix(translator): stop seeding api_key_auth from the first keyed route The listener-level api_key_auth filter is emitted disabled and switched on per route through typed_per_filter_config, but it was built from the first route on the listener that uses API key authentication. That publishes one route's credentials in the listener, so adding or rotating a key on that route rewrites the listener. Envoy then replaces the filter chain and drains the superseded one, terminating long-lived requests on every route of the listener. The same change on any other route is a route-only update that costs nothing, so which route pays is an artifact of ordering. Build the listener-level filter from an empty config instead. The per route configs are unchanged. Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: add release note for the api_key_auth listener fix Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: reword the api_key_auth release note per review Signed-off-by: John Lybeck <john.lybeck@amd.com> --------- Signed-off-by: John Lybeck <john.lybeck@amd.com> * chore: bump golang.org/x/net to v0.60.0 (#10254) Fixes CVE-2026-97032, CVE-2026-78659, CVE-2026-78660, CVE-2026-78663 and CVE-2026-78669. Signed-off-by: Hariharan Subramanian <hsubramanian@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c55c776d-397b-4a82-a279-d91e0e21e10d * fix: route status condition order (#10183) * fix(status): report route status conditions in a deterministic order Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * add release note Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix(provider): index HTTPRouteFilters referenced only from backendRef filters (#10246) * fix(provider): index HTTPRouteFilters referenced only from backendRef filters Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * renumber release note Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix: record a BackendTrafficPolicy on a TCP or UDP route once (#10289) A policy with mergeType is applied once per listener of each parentRef, and a parentRef with a sectionName can name a listener another parentRef already covers. The feature fields are only set when nil, but the policy metadata was appended on every pass, so a TCP, TLS or UDP route attached to the same Gateway twice carried the policy twice. The append now skips a policy the route already records. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix(status): match route parent status by parentRef and controllerName (#10327) * fix(status): match route parent status by parentRef and controllerName mergeRouteParentStatus matched old and new RouteParentStatus entries by parentRef only. When another controller had written its own entry for the same parentRef, that entry was replaced by our status, so the route ended up with two entries of ours. The other controller then re-added its entry, and every following merge added one more duplicate until status.parents reached its maxItems of 32 and all further status writes to the route were rejected. Match entries by parentRef and controllerName, and append each new entry only once so existing duplicates are collapsed on the next update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Freem <freemanovec@protonmail.com> * Add release note for route parent status fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Freem <freemanovec@protonmail.com> --------- Signed-off-by: Freem <freemanovec@protonmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * fix: report merged route policy status on the parentRef ancestor (#10315) * fix: report merged route policy status on the parentRef ancestor Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * remove todo comments and dead code Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix: make namespace watch cache ByObject entries deterministic (#10302) * fix: make namespace watch cache ByObject entries deterministic ByObject is keyed by object pointer, so the WatchesNamespaces() block added a second entry for types already registered (Secret, ConfigMap, Service, EndpointSlice, ServiceAccount, Deployment) and the cache kept one at random. Replace the existing entry for the type instead, and grant EndpointSlice read in the controller namespace for Gateway Namespace Mode with watch namespaces. Fixes #10271 Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> * test: regenerate helm golden for gateway-namespace-config-watch Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> --------- Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> * fix(helm): grant controller namespace Secret/EndpointSlice read with watch.namespaces (#10377) Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix: not exist field Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix: generate testdata Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: Clement Phu <clement.phu@hotmail.fr> Signed-off-by: Cooper Gamble <cooper@openai.com> Signed-off-by: stillya <st.ilya.101@gmail.com> Signed-off-by: Seiji Chew <seiji@exa.ai> Signed-off-by: John Lybeck <john.lybeck@amd.com> Signed-off-by: Hariharan Subramanian <hsubramanian@microsoft.com> Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: Freem <freemanovec@protonmail.com> Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> Co-authored-by: Clement Phu <34369901+cleman95@users.noreply.github.com> Co-authored-by: cooper-oai <cooper@openai.com> Co-authored-by: Starchenko Ilya <st.ilya.101@gmail.com> Co-authored-by: Seiji Chew <67301797+schew2381@users.noreply.github.com> Co-authored-by: Seiji Chew <seiji@exa.ai> Co-authored-by: Lybeck <john.lybeck@amd.com> Co-authored-by: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Co-authored-by: Freem <freemanovec@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Manish <69393822+manish-9245@users.noreply.github.com> Copilot-Session: c55c776d-397b-4a82-a279-d91e0e21e10d
zirain
pushed a commit
to zirain/gateway
that referenced
this pull request
Oct 25, 2026
…envoyproxy#10190) * fix(translator): stop seeding api_key_auth from the first keyed route The listener-level api_key_auth filter is emitted disabled and switched on per route through typed_per_filter_config, but it was built from the first route on the listener that uses API key authentication. That publishes one route's credentials in the listener, so adding or rotating a key on that route rewrites the listener. Envoy then replaces the filter chain and drains the superseded one, terminating long-lived requests on every route of the listener. The same change on any other route is a route-only update that costs nothing, so which route pays is an artifact of ordering. Build the listener-level filter from an empty config instead. The per route configs are unchanged. Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: add release note for the api_key_auth listener fix Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: reword the api_key_auth release note per review Signed-off-by: John Lybeck <john.lybeck@amd.com> --------- Signed-off-by: John Lybeck <john.lybeck@amd.com> Signed-off-by: zirain <zirain2009@gmail.com>
zirain
added a commit
that referenced
this pull request
Oct 25, 2026
* fix(infrastructure): mount writable /tmp on the shutdown-manager (#10120) * fix(infrastructure): mount writable /tmp on the shutdown-manager The shutdown-manager signals drain completion by creating /tmp/shutdown-ready. Since the fix for #4881, the controller replicates the user-provided Envoy container securityContext onto the shutdown-manager. When that securityContext sets readOnlyRootFilesystem: true, the shutdown-manager can no longer create the file, the Envoy preStop hook never gets a 200, the kubelet logs FailedPreStopHook, and both containers are SIGKILLed after the full grace period, making every proxy pod deletion take the full terminationGracePeriodSeconds instead of the drain duration. Mount a dedicated writable emptyDir at /tmp on the shutdown-manager (same approach as the writable wasm-cache emptyDir added for the control plane in #9069). The user's securityContext replication is preserved (custom runAsUser, capabilities, readOnlyRootFilesystem: true all keep working), so hardened deployments no longer break graceful shutdown. Fixes #10119 Signed-off-by: Clement Phu <clement.phu@hotmail.fr> * fix(shutdown-manager): clear stale shutdown ready marker at startup An emptyDir volume persists across container restarts within the same pod, so a /tmp/shutdown-ready marker created by a previous drain could short-circuit the next drain sequence. Remove the marker when the shutdown manager starts. Signed-off-by: Clement Phu <clement.phu@hotmail.fr> * fix(infrastructure): combine volume appends to satisfy gocritic Address the appendCombine lint failure reported by CI. Signed-off-by: Clement Phu <clement.phu@hotmail.fr> --------- Signed-off-by: Clement Phu <clement.phu@hotmail.fr> Signed-off-by: zirain <zirain2009@gmail.com> * fix(message): release discarded coalesced updates (#10144) * [envoy-gateway] Release discarded coalesced snapshots [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> * [envoy-gateway] Note coalesced update retention fix [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> --------- Signed-off-by: Cooper Gamble <cooper@openai.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix(translator): use own route config name for TLS listeners sharing port with HTTP (#10171) * fix(translator): use own route config name for TLS listeners sharing a port with HTTP When an HTTP listener shares a container port with HTTPS listeners and is translated first, HTTPS virtual hosts ended up in its RouteConfiguration while their own filter chains referenced route configs that never existed. Default filter chain lookup only applies to plain HTTP listeners. Fixes #10170 Signed-off-by: stillya <st.ilya.101@gmail.com> * docs: add release note for #10171 Signed-off-by: stillya <st.ilya.101@gmail.com> --------- Signed-off-by: stillya <st.ilya.101@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix: handle EndpointSlices labelled with both a Service and a ServiceImport (#10192) * fix: handle EndpointSlices labelled with both a Service and a ServiceImport Fixes #10191 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: Seiji Chew <seiji@exa.ai> * release-notes: use PR number for MCS EndpointSlice fix Signed-off-by: Seiji Chew <seiji@exa.ai> --------- Signed-off-by: Seiji Chew <seiji@exa.ai> Co-authored-by: Seiji Chew <seiji@exa.ai> Signed-off-by: zirain <zirain2009@gmail.com> * fix(translator): stop seeding api_key_auth from the first keyed route (#10190) * fix(translator): stop seeding api_key_auth from the first keyed route The listener-level api_key_auth filter is emitted disabled and switched on per route through typed_per_filter_config, but it was built from the first route on the listener that uses API key authentication. That publishes one route's credentials in the listener, so adding or rotating a key on that route rewrites the listener. Envoy then replaces the filter chain and drains the superseded one, terminating long-lived requests on every route of the listener. The same change on any other route is a route-only update that costs nothing, so which route pays is an artifact of ordering. Build the listener-level filter from an empty config instead. The per route configs are unchanged. Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: add release note for the api_key_auth listener fix Signed-off-by: John Lybeck <john.lybeck@amd.com> * docs: reword the api_key_auth release note per review Signed-off-by: John Lybeck <john.lybeck@amd.com> --------- Signed-off-by: John Lybeck <john.lybeck@amd.com> Signed-off-by: zirain <zirain2009@gmail.com> * chore: bump golang.org/x/net to v0.60.0 (#10254) Fixes CVE-2026-97032, CVE-2026-78659, CVE-2026-78660, CVE-2026-78663 and CVE-2026-78669. Signed-off-by: Hariharan Subramanian <hsubramanian@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c55c776d-397b-4a82-a279-d91e0e21e10d Signed-off-by: zirain <zirain2009@gmail.com> * fix: route status condition order (#10183) * fix(status): report route status conditions in a deterministic order Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * add release note Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix(provider): index HTTPRouteFilters referenced only from backendRef filters (#10246) * fix(provider): index HTTPRouteFilters referenced only from backendRef filters Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * renumber release note Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix: record a BackendTrafficPolicy on a TCP or UDP route once (#10289) A policy with mergeType is applied once per listener of each parentRef, and a parentRef with a sectionName can name a listener another parentRef already covers. The feature fields are only set when nil, but the policy metadata was appended on every pass, so a TCP, TLS or UDP route attached to the same Gateway twice carried the policy twice. The append now skips a policy the route already records. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: zirain <zirain2009@gmail.com> * fix(status): match route parent status by parentRef and controllerName (#10327) * fix(status): match route parent status by parentRef and controllerName mergeRouteParentStatus matched old and new RouteParentStatus entries by parentRef only. When another controller had written its own entry for the same parentRef, that entry was replaced by our status, so the route ended up with two entries of ours. The other controller then re-added its entry, and every following merge added one more duplicate until status.parents reached its maxItems of 32 and all further status writes to the route were rejected. Match entries by parentRef and controllerName, and append each new entry only once so existing duplicates are collapsed on the next update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Freem <freemanovec@protonmail.com> * Add release note for route parent status fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Freem <freemanovec@protonmail.com> --------- Signed-off-by: Freem <freemanovec@protonmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix: make namespace watch cache ByObject entries deterministic (#10302) * fix: make namespace watch cache ByObject entries deterministic ByObject is keyed by object pointer, so the WatchesNamespaces() block added a second entry for types already registered (Secret, ConfigMap, Service, EndpointSlice, ServiceAccount, Deployment) and the cache kept one at random. Replace the existing entry for the type instead, and grant EndpointSlice read in the controller namespace for Gateway Namespace Mode with watch namespaces. Fixes #10271 Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> * test: regenerate helm golden for gateway-namespace-config-watch Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> --------- Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix(helm): grant controller namespace Secret/EndpointSlice read with watch.namespaces (#10377) Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> * fix lint Signed-off-by: zirain <zirain2009@gmail.com> * fix gen Signed-off-by: zirain <zirain2009@gmail.com> * fix: deterministic parentRef order (#10393) Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: Clement Phu <clement.phu@hotmail.fr> Signed-off-by: zirain <zirain2009@gmail.com> Signed-off-by: Cooper Gamble <cooper@openai.com> Signed-off-by: stillya <st.ilya.101@gmail.com> Signed-off-by: Seiji Chew <seiji@exa.ai> Signed-off-by: John Lybeck <john.lybeck@amd.com> Signed-off-by: Hariharan Subramanian <hsubramanian@microsoft.com> Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: Freem <freemanovec@protonmail.com> Signed-off-by: Manish Tiwari <69393822+manish-9245@users.noreply.github.com> Co-authored-by: Clement Phu <34369901+cleman95@users.noreply.github.com> Co-authored-by: cooper-oai <cooper@openai.com> Co-authored-by: Starchenko Ilya <st.ilya.101@gmail.com> Co-authored-by: Seiji Chew <67301797+schew2381@users.noreply.github.com> Co-authored-by: Seiji Chew <seiji@exa.ai> Co-authored-by: Lybeck <john.lybeck@amd.com> Co-authored-by: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Kota Kimura <86363983+kkk777-7@users.noreply.github.com> Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Co-authored-by: Freem <freemanovec@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Manish <69393822+manish-9245@users.noreply.github.com> Copilot-Session: c55c776d-397b-4a82-a279-d91e0e21e10d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Editing the API keys on one route can kill in-flight requests on unrelated routes that happen
to share the same listener.
Here is why. The
api_key_authfilter goes on the listener once, disabled, and each routeswitches it on through
typed_per_filter_configwith its own credentials. The listener copy ismeant to be inert, and there is a comment in
patchHCMsaying exactly that: "the HCM-levelfilter config doesn't matter since it is overridden at the route level". But it was not built
empty. It was built from whichever route happened to come first in the list.
So one arbitrary route's credentials end up living in the listener. Changing keys on a route is
normally a cheap route-only RDS update, but for that one unlucky route it rewrites the listener
instead. Envoy then swaps the filter chain, drains the old one, and every long-lived request on
that listener goes down with it, including requests on routes that have nothing to do with the
policy you just edited. Which route draws the short straw is purely an artifact of ordering, so
from the outside it looks random.
The fix is to build the listener filter from an empty
ApiKeyAuth. Routes already supply theirown credentials and key sources, so nothing is lost. Per-route configs are untouched.
Three notes for reviewers:
forwardingtoo. That looks riskier than it is. Envoy initialisesforwarding_unconditionally fromproto_config.forwarding(), so the route-level value isalways in play and the listener's copy was already dead for every route. It is a no-op.
credentialRefsresolve to no credentials at allused to fall back to the listener's. With the listener empty it now returns 401. You can get
into that state today, since
credentialRefshas nominItemsand the referenced Secret isonly checked for existence.
it on
patchRoute. Envoy merges the two levels field by field rather than replacing one withthe other, which is the whole reason this bug exists. Corrected in the same commit.
I kept the single shared filter and emptied it, rather than going the
basicauth.goroute ofone filter per route, since it is the smaller change and matches what
cors.goandcsrf.goalready do.
Validation:
main, where the listener carriesclient-1/key1from thefirst route, and passes with this change.
api-key-auth.listeners.yamlshows the listener filter losingcredentials,keySourcesandforwarding, while every per-route config inapi-key-auth.routes.yamlstays exactly as it was.
egctl experimental translate. Two keyed routes on onelistener, translated once with a single key on the first route and again with a second key
added. On
mainthe listener output differs between the two runs, because the addedcredential lands in the listener-level config. With this change the listener output is
byte-identical and the new credential appears only in the route's own
typed_per_filter_config.go test ./internal/xds/translator/...,make gen-check, and the repository-pinnedgolangci-lintfor the changed package all pass locally, as doyamllintandcodespellonthe changed files and the release-notes filename check.
Which issue(s) this PR fixes: No linked issue.
PR Checklist
/api.make gen-check, the repository-pinnedgolangci-lintfor the changed package, the release-notes filename check, and the package unit tests pass locally. Full CI lint and the coverage build remain pending.api_key_auth_test.goadds three cases covering the listener-level config, the no-API-key-route case, and the already-present filter case.release-notes/current/bug_fixes/10190-api-key-auth-listener-churn.md; the repository filename check passes.make gen-checkis clean.