Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
04f0998
ext_authz: support response headers on OK authorization check
esmet Dec 13, 2020
41e71d4
Fix a test, add changelog entry
esmet Jan 5, 2021
83e2299
Add response header encoding, write a test, make it pass.
esmet Jan 5, 2021
47aa43e
Simplify by using a PassThroughEncoderFilter
esmet Jan 6, 2021
2d81472
Revert PassThroughEncoderFilter and increase test coverage instead
esmet Jan 6, 2021
b5d31d3
Add coverage for allowed_client_headers_on_success
esmet Jan 6, 2021
8ffbf7d
Kick CI
esmet Jan 6, 2021
4880f64
Merge branch 'master' into ext-authz-headers-on-success
esmet Jan 6, 2021
aafe6a3
Merge remote-tracking branch 'upstream/master' into ext-authz-headers…
esmet Jan 11, 2021
2773a24
Merge remote-tracking branch 'upstream/main' into ext-authz-headers-o…
esmet Jan 26, 2021
ff70736
Address CR comments
esmet Jan 26, 2021
65ce2bf
Move headers instead of copying into a HeaderVector on the heap
esmet Jan 27, 2021
178bea9
Fix changelog
esmet Jan 27, 2021
fa107b4
Fix proto generation
esmet Jan 27, 2021
9f106c0
Update api proto comments to link back to HeaderValueOption
esmet Jan 27, 2021
c3aa4fc
Current attempt at an integration test for downstream headers on success
esmet Jan 28, 2021
d94054e
Merge remote-tracking branch 'upstream/main' into ext-authz-headers-o…
esmet Jan 28, 2021
fa27e7f
Fix ext_authz config to support the encoding path, and update a test.
esmet Jan 29, 2021
e8fc587
Merge remote-tracking branch 'origin/main' into ext-authz-headers-on-…
esmet Jan 29, 2021
b374b12
Merge remote-tracking branch 'upstream/main' into ext-authz-headers-o…
esmet Jan 29, 2021
17dcba7
Merge remote-tracking branch 'origin/main' into ext-authz-headers-on-…
esmet Feb 1, 2021
5175cec
Fix ext_authz config test
esmet Feb 2, 2021
362e4a4
Fix test
esmet Feb 8, 2021
3052d02
Fix CR comments
esmet Feb 9, 2021
39eac44
Merge remote-tracking branch 'upstream/main' into ext-authz-headers-o…
esmet Feb 9, 2021
d826348
Fix syntax
esmet Feb 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ message BufferSettings {
// additional headers metadata may be added to the original client request. See
// :ref:`allowed_upstream_headers
// <envoy_api_field_extensions.filters.http.ext_authz.v3.AuthorizationResponse.allowed_upstream_headers>`
// for details. Additionally, the filter may add additional headers to the client's response. See
// :ref:`allowed_client_headers_on_success
// <envoy_api_field_extensions.filters.http.ext_authz.v3.AuthorizationResponse.allowed_client_headers_on_success>`
// for details.
//
// On other authorization response statuses, the filter will not allow traffic. Additional headers
Expand Down Expand Up @@ -252,6 +255,12 @@ message AuthorizationResponse {
// (Host)* will be in the response to the client. When a header is included in this list, *Path*,
// *Status*, *Content-Length*, *WWWAuthenticate* and *Location* are automatically added.
type.matcher.v3.ListStringMatcher allowed_client_headers = 2;

// When this :ref:`list <envoy_api_msg_type.matcher.v3.ListStringMatcher>`. is set, authorization
// response headers that have a correspondent match will be added to the client's response when
// the authorization response itself is successful, i.e. not failed or denied. When this list is
// *not* set, no additional headers will be added to the client's response on success.
type.matcher.v3.ListStringMatcher allowed_client_headers_on_success = 4;
}

// Extra settings on a per virtualhost/route/weighted-cluster level.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions api/envoy/service/auth/v3/external_auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ message DeniedHttpResponse {
type.v3.HttpStatus status = 1 [(validate.rules).message = {required: true}];

// This field allows the authorization service to send HTTP response headers
// to the downstream client. Note that the `append` field in `HeaderValueOption` defaults to
// to the downstream client. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
// false when used in this message.
repeated config.core.v3.HeaderValueOption headers = 2;

Expand All @@ -60,14 +60,14 @@ message DeniedHttpResponse {
}

// HTTP attributes for an OK response.
// [#next-free-field: 6]
// [#next-free-field: 7]
message OkHttpResponse {
option (udpa.annotations.versioning).previous_message_type =
"envoy.service.auth.v2.OkHttpResponse";

// HTTP entity headers in addition to the original request headers. This allows the authorization
// service to append, to add or to override headers from the original request before
// dispatching it to the upstream. Note that the `append` field in `HeaderValueOption` defaults to
// dispatching it to the upstream. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
// false when used in this message. By setting the `append` field to `true`,
// the filter will append the correspondent header value to the matched request header.
// By leaving `append` as false, the filter will either add a new header, or override an existing
Expand Down Expand Up @@ -96,6 +96,11 @@ message OkHttpResponse {
// setting this field overrides :ref:`CheckResponse.dynamic_metadata
// <envoy_v3_api_field_service.auth.v3.CheckResponse.dynamic_metadata>`.
google.protobuf.Struct dynamic_metadata = 3 [deprecated = true];

// This field allows the authorization service to send HTTP response headers
// to the downstream client on success. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>`
// defaults to false when used in this message.
repeated config.core.v3.HeaderValueOption response_headers_to_add = 6;
}

// Intended for gRPC and Network Authorization servers `only`.
Expand Down
11 changes: 8 additions & 3 deletions api/envoy/service/auth/v4alpha/external_auth.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ New Features
* compression: add brotli :ref:`compressor <envoy_v3_api_msg_extensions.compression.brotli.compressor.v3.Brotli>` and :ref:`decompressor <envoy_v3_api_msg_extensions.compression.brotli.decompressor.v3.Brotli>`.
* config: add `envoy.features.fail_on_any_deprecated_feature` runtime key, which matches the behaviour of compile-time flag `ENVOY_DISABLE_DEPRECATED_FEATURES`, i.e. use of deprecated fields will cause a crash.
* dispatcher: supports a stack of `Envoy::ScopeTrackedObject` instead of a single tracked object. This will allow Envoy to dump more debug information on crash.
* ext_authz: added :ref:`response_headers_to_add <envoy_v3_api_field_service.auth.v3.OkHttpResponse.response_headers_to_add>` to support sending response headers to downstream clients on OK authorization checks via gRPC.
* ext_authz: added :ref:`allowed_client_headers_on_success <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.AuthorizationResponse.allowed_client_headers_on_success>` to support sending response headers to downstream clients on OK external authorization checks via HTTP.
* grpc_json_transcoder: added option :ref:`strict_http_request_validation <envoy_v3_api_field_extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder.strict_http_request_validation>` to reject invalid requests early.
* grpc_json_transcoder: filter can now be configured on per-route/per-vhost level as well. Leaving empty list of services in the filter configuration disables transcoding on the specific route.
* http: added support for `Envoy::ScopeTrackedObject` for HTTP/1 dispatching. Crashes while inside the dispatching loop should dump debug information.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions generated_api_shadow/envoy/service/auth/v3/external_auth.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions source/extensions/filters/common/ext_authz/ext_authz.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ struct Response {
// A set of HTTP headers returned by the authorization server, will be optionally added
// (using "addCopy") to the request to the upstream server.
Http::HeaderVector headers_to_add;
// A set of HTTP headers returned by the authorization server, will be optionally added
// (using "addCopy") to the response sent back to the downstream client on OK auth
// responses.
Http::HeaderVector response_headers_to_add;
// A set of HTTP headers consumed by the authorization server, will be removed
// from the request to the upstream server.
std::vector<Envoy::Http::LowerCaseString> headers_to_remove;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ void GrpcClientImpl::onSuccess(std::unique_ptr<envoy::service::auth::v3::CheckRe
authz_response->headers_to_remove.push_back(Http::LowerCaseString(header));
}
}
if (response->ok_response().response_headers_to_add_size() > 0) {
for (const auto& header : response->ok_response().response_headers_to_add()) {
authz_response->response_headers_to_add.emplace_back(
Http::LowerCaseString(header.header().key()), header.header().value());
}
}
}
} else {
span.setTag(TracingConstants::get().TraceStatus, TracingConstants::get().TraceUnauthz);
Expand Down
Loading