-
Notifications
You must be signed in to change notification settings - Fork 5.3k
authz_filter: extended ext_authz to support v2alpha api #3162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
9501403
authz_v2alpha: initial commit
8419745
authz_v2alpha: fixed format
e6d6df0
authz_v2alpha: fixed format with right version
af3925b
authz_v2alpha: code review changes
33e7eba
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
0ed4639
authz_v2alpha: added missing proto
ab5cf4c
authz_v2alpha: fixed response initialization
615b64c
authz_v2alpha: implemented http client
050f75f
authz_v2alpha: merged master
7e9cf7c
authz_v2alpha: renamed authz implementation files
09e4125
authz_v2alpha: move http_status into envoy type
eb45964
authz_v2alpha: improved ext_authz_grpc_impl tests
5bd6581
authz_v2alpha: code review changes
559c8fb
authz_v2alpha: minor formatting fixes
f717cda
authz_v2alpha: changed authz response to use base header_option and f…
69ca997
authz_v2alpha: changed authz response to use base header_option and f…
568b5c1
authz_v2alpha: added tests for common ext_authz http impl and other c…
fe9fa0c
authz_v2alpha: added tests
d6e008c
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
dc61d76
authz_v2alpha: added comments to the test cases
982a210
authz_v2alpha: fixed docs and format
7acf696
authz_v2alpha: changed the docs and updated the release notes
4b3520d
authz_v2alpha: added extra line
dd9d091
authz_v2alpha: added code review changes
f1aa15f
authz_v2alpha: fixed conflict
c454122
authz_v2alpha: improved test coverage for ext_authz HTPP filter
681bc64
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
f8155ab
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
0250a49
authz_v2alpha: improved ext_authz HTTP filter branch test coverage
14889bc
authz_v2alpha: improved ext_authz HTTP client test coverage
e17a6fc
authz_v2alpha: fixed sanitizer error
a760b45
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
e2ba046
authz_v2alpha: improved gRPC authz client test coverage
298a696
authz_v2alpha: improved gRPC authz client branch test coverage
8d05a5d
authz_v2alpha: improved http authz client branch test coverage
b7aaef1
authz_v2alpha: improved http authz filter test
6058248
authz_v2alpha: added test for unknown HTTP status code use case
91db962
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
5c320bb
authz_v2alpha: fixed format
a5fcd62
Merge remote-tracking branch 'upstream/master' into authz_grpc_v2alpha
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.type; | ||
|
|
||
| import "validate/validate.proto"; | ||
|
|
||
| // HTTP response codes supported in Envoy. | ||
| // For more details: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml | ||
| enum StatusCode { | ||
| // Empty - This code not part of the HTTP status code specification, but it is needed for proto `enum` type. | ||
| Empty = 0; | ||
|
|
||
| Continue = 100; | ||
|
|
||
| OK = 200; | ||
| Created = 201; | ||
| Accepted = 202; | ||
| NonAuthoritativeInformation = 203; | ||
| NoContent = 204; | ||
| ResetContent = 205; | ||
| PartialContent = 206; | ||
| MultiStatus = 207; | ||
| AlreadyReported = 208; | ||
| IMUsed = 226; | ||
|
|
||
| MultipleChoices = 300; | ||
| MovedPermanently = 301; | ||
| Found = 302; | ||
| SeeOther = 303; | ||
| NotModified = 304; | ||
| UseProxy = 305; | ||
| TemporaryRedirect = 307; | ||
| PermanentRedirect = 308; | ||
|
|
||
| BadRequest = 400; | ||
| Unauthorized = 401; | ||
| PaymentRequired = 402; | ||
| Forbidden = 403; | ||
| NotFound = 404; | ||
| MethodNotAllowed = 405; | ||
| NotAcceptable = 406; | ||
| ProxyAuthenticationRequired = 407; | ||
| RequestTimeout = 408; | ||
| Conflict = 409; | ||
| Gone = 410; | ||
| LengthRequired = 411; | ||
| PreconditionFailed = 412; | ||
| PayloadTooLarge = 413; | ||
| URITooLong = 414; | ||
| UnsupportedMediaType = 415; | ||
| RangeNotSatisfiable = 416; | ||
| ExpectationFailed = 417; | ||
| MisdirectedRequest = 421; | ||
| UnprocessableEntity = 422; | ||
| Locked = 423; | ||
| FailedDependency = 424; | ||
| UpgradeRequired = 426; | ||
| PreconditionRequired = 428; | ||
| TooManyRequests = 429; | ||
| RequestHeaderFieldsTooLarge = 431; | ||
|
|
||
| InternalServerError = 500; | ||
| NotImplemented = 501; | ||
| BadGateway = 502; | ||
| ServiceUnavailable = 503; | ||
| GatewayTimeout = 504; | ||
| HTTPVersionNotSupported = 505; | ||
| VariantAlsoNegotiates = 506; | ||
| InsufficientStorage = 507; | ||
| LoopDetected = 508; | ||
| NotExtended = 510; | ||
| NetworkAuthenticationRequired = 511; | ||
|
|
||
| } | ||
|
|
||
| // HTTP status. | ||
| message HttpStatus { | ||
| // Supplies HTTP response code. | ||
| StatusCode code = 1 [ | ||
| (validate.rules).enum = {not_in: [0]}, | ||
| (validate.rules).enum.defined_only = true | ||
| ]; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,6 @@ Types | |
| :glob: | ||
| :maxdepth: 2 | ||
|
|
||
| ../type/http_status.proto | ||
| ../type/percent.proto | ||
| ../type/range.proto | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,11 @@ External Authorization | |
| * External authorization :ref:`architecture overview <arch_overview_ext_authz>` | ||
| * :ref:`HTTP filter v2 API reference <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>` | ||
|
|
||
| The external authorization HTTP filter calls an external gRPC service to check if the incoming | ||
| The external authorization HTTP filter calls an external gRPC or HTTP service to check if the incoming | ||
| HTTP request is authorized or not. | ||
| If the request is deemed unauthorized then the request will be denied with 403 (Forbidden) response. | ||
| If the request is deemed unauthorized then the request will be denied normally with 403 (Forbidden) response. | ||
| Note that sending additional custom metadata from the authorization service to the upstream, or to the downstream is | ||
| also possible. This is explained in more details at :ref:`HTTP filter <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>`. | ||
|
|
||
| .. tip:: | ||
| It is recommended that this filter is configured first in the filter chain so that requests are | ||
|
|
@@ -18,14 +20,14 @@ The content of the requests that are passed to an authorization service is speci | |
|
|
||
| .. _config_http_filters_ext_authz_http_configuration: | ||
|
|
||
| The HTTP filter, using a gRPC service, can be configured as follows. You can see all the | ||
| The HTTP filter, using a gRPC/HTTP service, can be configured as follows. You can see all the | ||
| configuration options at | ||
| :ref:`HTTP filter <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>`. | ||
|
|
||
| Example | ||
| ------- | ||
| Configuration Examples | ||
| ----------------------------- | ||
|
|
||
| A sample filter configuration could be: | ||
| A sample filter configuration for a gRPC authorization server: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
|
|
@@ -36,13 +38,39 @@ A sample filter configuration could be: | |
| envoy_grpc: | ||
| cluster_name: ext-authz | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| clusters: | ||
| - name: ext-authz | ||
| type: static | ||
| http2_protocol_options: {} | ||
| hosts: | ||
| - socket_address: { address: 127.0.0.1, port_value: 10003 } | ||
|
|
||
| A sample filter configuration for a raw HTTP authorization server: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| http_filters: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically this is embedded somewhat in a |
||
| - name: envoy.ext_authz | ||
| config: | ||
| http_service: | ||
| server_uri: | ||
| uri: 127.0.0.1:10003 | ||
| cluster: ext-authz | ||
| timeout: 0.25s | ||
| failure_mode_allow: false | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| clusters: | ||
| - name: ext-authz | ||
| connect_timeout: 0.25s | ||
| type: logical_dns | ||
| lb_policy: round_robin | ||
| hosts: | ||
| - socket_address: { address: 127.0.0.1, port_value: 10003 } | ||
|
|
||
| Statistics | ||
| ---------- | ||
| The HTTP filter outputs statistics in the *cluster.<route target cluster>.ext_authz.* namespace. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wora @mattklein123 WDYT? I like this, but do we have extensibility issues or concerns over wanting custom response codes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wora @mattklein123 friendly ping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any context. Why do we need custom response codes? It's definitely not optimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering if this status code object is sufficient for all anticipated uses across the Envoy API surface. Ack or Nack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes seems fine. If we want custom status codes we can always add them later with comments. Can we add a validation that the enum only has the specified values, at least for now?