Add an explicit state for whether filter chain should continue or not.#3334
Add an explicit state for whether filter chain should continue or not.#3334htuch merged 5 commits intoenvoyproxy:masterfrom colabsaumoh:authz-filter-crash
Conversation
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
| initiateCall(headers); | ||
| return state_ == State::Calling ? Http::FilterHeadersStatus::StopIteration | ||
| : Http::FilterHeadersStatus::Continue; | ||
| return filter_return_ == FilterReturn::StopDecoding ? Http::FilterHeadersStatus::StopIteration |
There was a problem hiding this comment.
Thanks for the fix. IMHO, we have a lot of complexity here, since we now have 3 state variables, and I can't see the clear relationship between them. The variables are filter_return_, initiating_call_ and state_. Can you write a comment explaining how they relate? Is there no way to simplify this?
There was a problem hiding this comment.
@htuch (cc @gsagula ) I added comments about these 3 states. I think it is possible to combine all of these and initially i had done some of that (see: #3259 (comment)). But then i found it harder to reason about all the states at the various locations that we use them.
I think its more important for others to read and understand the use of these states (and not just me) so any recommendations/suggestion from either of you would be quite helpful.
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
|
@saumoh thanks, this is quite easy to understand now. Some additional questions:
|
|
@htuch i am not sure about point 1 in your note. I'll have to think about it. Largely the filter chain return values are well documented (i feel). The async and synchronous duality of the call backs is a bit trick. If there was a abstraction that hid these for async callers then it would be useful for the general async usage. |
|
Hi @saumoh, I'm no using |
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
Signed-off-by: Saurabh Mohan <saurabh+github@tigera.io>
|
@gsagula see It's a way to respond back from the proxy itself and add additional headers, body and text. It was already added upstream :-) |
|
Awesome, thanks 👍 |
Fix for ext_authz filter crash
Description:
This is a fix for #3259
The problem was when the
ext_authzfilter's gRPC cluster is incorrect. In this case theonCompletecallback is on the stack (withError) but the filter chain continues to the next filter (router). That is incorrect. Instead the filter chain should be stopped from moving on to the next filter in the chain.The fix is to explicitly track whether the filterchain should be allowed to continue or not.
Risk Level: Low
Testing:
Added UT's for the on-stack error return case.
Docs Changes: N/A
[Optional Fixes #Issue]
#3259
cc @gsagula @julia-stripe