ext-authz: fix missing UAEX flag on Denied CheckResponse#18965
ext-authz: fix missing UAEX flag on Denied CheckResponse#18965yanavlasov merged 2 commits intoenvoyproxy:mainfrom
Conversation
|
Hi @pims, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
|
@pims thanks for fixing this. Can you also add a test case for the fixed problem, please? |
|
@yanavlasov thanks for taking a look at this PR. I've updated the tests to reflect the new call sequence. Original code decoder_callbacks_->sendLocalReply(response->status_code, …);
decoder_callbacks_->streamInfo().setResponseFlag(
StreamInfo::ResponseFlag::UnauthorizedExternalService);My understanding is that the code intends to set the After re-ordering the calls, the unit tests were failing. // source/extensions/filters/http/fault/fault_filter.cc
decoder_callbacks_->streamInfo().setResponseFlag(StreamInfo::ResponseFlag::FaultInjected);
decoder_callbacks_->sendLocalReply(http_status_code, "fault filter abort", …);
// test/extensions/filters/http/fault/fault_filter_test.cc
EXPECT_CALL(decoder_filter_callbacks_.stream_info_,
setResponseFlag(StreamInfo::ResponseFlag::DelayInjected));
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
filter_->decodeHeaders(request_headers_, false));Following the above pattern, tests are now passing. EXPECT_CALL(filter_callbacks_.stream_info_,
setResponseFlag(Envoy::StreamInfo::ResponseFlag::UnauthorizedExternalService));
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter_->decodeHeaders(request_headers_, false));I'm very new to the Envoy code base, so please let me know if my assumptions aren't correct. |
This fixes a bug in which the UAEX flag is not set prior to calling `callback->sendLocalReply(...)`. Signed-off-by: Tim Bart <tbart@cloudflare.com>
85818f2 to
cab2f0b
Compare
|
I forced push to fix the DCO as instructed in https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md#fixing-dco |
| config_->httpContext().codeStats().chargeResponseStat(info, false); | ||
| } | ||
|
|
||
| decoder_callbacks_->streamInfo().setResponseFlag( |
There was a problem hiding this comment.
This makes sense.
Optional: Mind to add a comment for future readers, that is why we set it prior to calling sendLocalReply.
There was a problem hiding this comment.
also can put setResponseFlag and sendLocalReply into a inline method, but currently this is enough for me.
| config_->httpContext().codeStats().chargeResponseStat(info, false); | ||
| } | ||
|
|
||
| decoder_callbacks_->streamInfo().setResponseFlag( |
There was a problem hiding this comment.
also can put setResponseFlag and sendLocalReply into a inline method, but currently this is enough for me.
Signed-off-by: Tim Bart <tbart@cloudflare.com>
|
@dio gentle nudge. Anything else you think should be added to this PR for it to be merged? I have found a similar bug in another filter, and was hoping to follow this PR’s template when submitting a bug fix. |
* main: Stats: Filter stats to be flushed to sinks (envoyproxy#18805) build(deps): bump sphinx from 4.3.0 to 4.3.1 in /tools/base (envoyproxy#19122) ext-authz: fix missing UAEX flag on Denied CheckResponse (envoyproxy#18965) lua: support body setBytes with header content length set automatically (envoyproxy#18989) Signed-off-by: Michael Puncel <mpuncel@squareup.com>
This fixes a bug in which the UAEX flag is not set prior to calling
callback->sendLocalReply(...).Commit Message: ext-authz: fix missing UAEX flag on Denied CheckResponse
Additional Description: See #18964
Risk Level: low
Testing: manual
Docs Changes: n/a
Release Notes: ext-authz: fix missing UAEX flag on Denied CheckResponse
Fixes #18964