Skip to content

Conversation

jrajahalme
Copy link
Member

Replace the network filter upstream callback patch with a new one that adds an upstream/read filter callback onDestinationSelected(). This is called before a new upstream connection is attempted to give chance for the network policy to deny making the new connection. The connection-level local reset is translated to a new access_denied stream reset reason, which in turn is translated to the HTTP response code 403.

This new read filter callback is only called for new connections, and not for each HTTP request like the old one. This makes it necessary to revert the recent change to not perform HTTP policy enforcement on requests if policy did not have any HTTP rules. With this change the HTTP policy enforcement is always made, as the policy may have changed since the network policy enforcement was done, even if there are no HTTP rules.

A second Envoy patch is added for backwards compatibility to call the new callback on the downstream filter chain if no upstream filters respond to it. This patch can be removed once the oldest supported Cilium release installs the upstream Cilium network filter.

@jrajahalme jrajahalme requested a review from a team as a code owner June 23, 2025 20:09
@jrajahalme jrajahalme requested a review from mhofstetter June 23, 2025 20:09
@jrajahalme jrajahalme marked this pull request as draft June 23, 2025 20:09
@jrajahalme jrajahalme added the enhancement New feature or request label Jun 23, 2025
@jrajahalme jrajahalme force-pushed the dual-network-filter branch 8 times, most recently from edcd478 to 97d5ad6 Compare June 27, 2025 09:35
Signed-off-by: Jarno Rajahalme <[email protected]>
Use 'empty' method when checking if a string is empty or not instead of
comparing 'length'. This makes the code a bit more readable.

Signed-off-by: Jarno Rajahalme <[email protected]>
Skip HTTP policy enforcement if no HTTP rules and the last policy lookup
was with the same policy version, remote identity and port.

This prepares for the next commit that makes network policy enforcement
only happen when new connection is created, rather than on each request.

Signed-off-by: Jarno Rajahalme <[email protected]>
Signed-off-by: Jarno Rajahalme <[email protected]>
@jrajahalme jrajahalme force-pushed the dual-network-filter branch from 97d5ad6 to c7a303e Compare July 2, 2025 13:34
Signed-off-by: Jarno Rajahalme <[email protected]>
@jrajahalme jrajahalme force-pushed the dual-network-filter branch 5 times, most recently from 0422d61 to 23b6d0b Compare July 2, 2025 18:11
Pass connection close from upstream response to downstream response when
upstream and downstream connections have the same 5-tuple. This helps
avoid connection freeze due to 5-tuple conflict.

Signed-off-by: Jarno Rajahalme <[email protected]>
@jrajahalme jrajahalme force-pushed the dual-network-filter branch from 23b6d0b to d6b4059 Compare July 3, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant