Conversation
328631a to
86d68ac
Compare
86d68ac to
759130e
Compare
|
@kannanjgithub PTAL, if the implementation mutation meets the spec for ext proc. You need to TAL at the last two commits only. |
759130e to
4bfd5e6
Compare
4bfd5e6 to
6961989
Compare
kannanjgithub
left a comment
There was a problem hiding this comment.
Sending comments for headermutations.
kannanjgithub
left a comment
There was a problem hiding this comment.
Reviewed rest of the PR.
|
@kannanjgithub I've resolved or clarified the comments as applicable. PTAL |
90e5491 to
efb725f
Compare
|
@kannanjgithub Addressed the comments. PTAL. |
|
/gemini review |
399e233 to
677b251
Compare
677b251 to
4ca257e
Compare
d999d4b to
0a3efdf
Compare
0a3efdf to
5261286
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the core infrastructure for xDS external authorization (ext_authz), including parsers for ExtAuthz and GrpcService configurations, a CachedChannelManager for authorization service connections, and a comprehensive header mutation system. Feedback focuses on HeaderMutator.java, specifically identifying a bug where the keepEmptyValue logic does not correctly align with Envoy's behavior for the APPEND action, which could lead to incorrect header persistence. Additionally, it is recommended to refactor duplicated Metadata.Key creation logic into a helper method to improve maintainability.
5261286 to
9ec272a
Compare
9ec272a to
951b761
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a CachedChannelManager to manage gRPC channels based on service configurations, alongside a new framework for processing xDS header mutations. The mutation framework includes components for filtering, applying, and validating header changes. Review feedback highlights the need to align the mutation order with the xDS specification, correct the logic for header allowance expressions, optimize performance by pre-calculating metadata keys, and improve error reporting with more descriptive exception messages.
8d6cd46 to
312f166
Compare
|
/gemini review - Please don't repeat previously addressed comments. |
There was a problem hiding this comment.
Code Review
This pull request introduces a CachedChannelManager for managing gRPC channels and a framework for xDS header mutations, including filtering and application logic. Key feedback includes aligning the order of header operations in HeaderMutator with Envoy by processing removals before additions and caching Metadata.Key objects to optimize performance. Furthermore, the filtering logic in HeaderMutationFilter needs adjustment to ensure disallowed headers properly trigger exceptions when strict validation is active.
c7777c2 to
46c951d
Compare
This commit introduces a library for handling header mutations as specified by the xDS protocol. This library provides the core functionality for modifying request and response headers based on a set of rules. The main components of this library are: - `HeaderMutator`: Applies header mutations to `Metadata` objects. - `HeaderMutationFilter`: Filters header mutations based on a set of configurable rules, such as disallowing mutations of system headers. - `HeaderMutations`: A value class that represents the set of mutations to be applied to request and response headers. - `HeaderMutationDisallowedException`: An exception that is thrown when a disallowed header mutation is attempted. This commit also includes comprehensive unit tests for the new library.
… headermutations libraries
46c951d to
9640f87
Compare
kannanjgithub
left a comment
There was a problem hiding this comment.
Some unit tests are missing.
| assertThat(filtered.headers()).containsExactly(header("x-allowed-key", "value")); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
nit: Remove extra empty line.
| assertThat(headers.get(keepEmptyKey)).isEqualTo(""); | ||
| assertThat(headers.containsKey(keepEmptyOverwriteKey)).isTrue(); | ||
| assertThat(headers.get(keepEmptyOverwriteKey)).isEqualTo(""); | ||
|
|
There was a problem hiding this comment.
nit: Remove unnecessary blank line.
| private void updateHeader(final HeaderValueOption option, Metadata mutableHeaders) { | ||
| HeaderValue header = option.header(); | ||
| HeaderAppendAction action = option.appendAction(); | ||
| boolean keepEmptyValue = option.keepEmptyValue(); |
There was a problem hiding this comment.
The commit b9caa47 refactored how keepEmptyValue is handled in HeaderMutator.java, moving the check from a post-action cleanup (checkAndRemoveEmpty) to a pre-action filter. The following
cases are not covered by the existing tests:
- Binary Headers: No tests exist for binary headers with empty values (empty ByteString) when keepEmptyValue is either true or false.
- Specific Actions: The OVERWRITE_IF_EXISTS and ADD_IF_ABSENT actions are not tested with empty values and keepEmptyValue=false.
- Behavior Change Verification: The new implementation skips the updateHeader call entirely if the value is empty and keepEmptyValue is false. This means existing values are preserved during an OVERWRITE action, whereas the old implementation would have removed them. This deliberate change in behavior needs explicit verification.
| * A generic helper to filter a collection based on a predicate. | ||
| */ | ||
| private <T> ImmutableList<T> filterCollection(Collection<T> items, | ||
| Predicate<T> isIgnoredPredicate, Predicate<T> isAllowedPredicate) |
There was a problem hiding this comment.
The commit 9640f87 updated HeaderMutationFilter.java to match Envoy's implementation, where headers that are either "ignored" (system headers like :path or grpc-*) or "disallowed" (by custom
rules) trigger a HeaderMutationDisallowedException when disallowIsError is enabled. Previously, ignored headers were skipped silently even if disallowIsError was true.
The following scenarios are missing coverage:
- DisallowIsError = False: No test verifies that disallowed/ignored headers are still silently skipped when disallowIsError is false.
- Rule-based Disallowance: No tests verify that headers disallowed by custom regex (disallowExpression) or disallowAll trigger the exception when disallowIsError is true.
- Rule-based Allowance Override: No test verifies that allowExpression correctly overrides disallowAll even when disallowIsError is true.
- System Header Rejection: While some tests were added in the commit for system headers, they don't cover the full range of HeaderValueValidationUtils logic (e.g., uppercase keys).
This PR sits on top of #12690, so only the last commit + any fixups need to be reviewed.
This commit introduces a library for handling header mutations as specified by the xDS protocol. This library provides the core functionality for modifying request and response headers based on a set of rules.
The main components of this library are:
HeaderMutator: Applies header mutations toMetadataobjects.HeaderMutationFilter: Filters header mutations based on a set of configurable rules, such as disallowing mutations of system headers.HeaderMutations: A value class that represents the set of mutations to be applied to request and response headers.HeaderMutationDisallowedException: An exception that is thrown when a disallowed header mutation is attempted.This commit also includes comprehensive unit tests for the new library.