-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Ext authz caching #44874
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
Open
toddmgreer
wants to merge
28
commits into
envoyproxy:main
Choose a base branch
from
toddmgreer:ext_authz_caching
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ext authz caching #44874
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ab52b39
ext_authz: implement cooperative caching bypass
toddmgreer d184a24
ext_authz: refactor http client to avoid explicit variables
toddmgreer c9b1ae7
ext_authz: apply review comments and add cache error tests
toddmgreer 8fbf7ec
ext_authz: document cooperative caching bypass
toddmgreer 66ee693
ext_authz: add cooperative caching release note
toddmgreer 4a3daf5
Merge remote-tracking branch 'upstream/main' into ext_authz_caching
toddmgreer df2d604
ext_authz: add cache integration tests
toddmgreer 1dd885d
ext_authz: refactor cache integration tests based on reviews
toddmgreer 46fe75f
ext_authz: transition cache bypass to typed dynamic metadata
toddmgreer b77bfd6
ext_authz: apply code formatting and style fixes
toddmgreer b413bf0
ext_authz: update cooperative caching docs and release notes
toddmgreer dd451c9
ext_authz: support pluggable caching via TypedExtensionConfig
toddmgreer c74c01d
ext_authz: remove old caching bypass and fix sync lookup
toddmgreer 65a4cfc
test(ext_authz): add unit tests for cache hit denied and error cases
toddmgreer b1e1934
test(ext_authz): add in-memory cache integration test
toddmgreer 4b29cbd
Merge branch 'main' into ext_authz_caching
toddmgreer c4741eb
test: fix compilation error and ext_authz_test merge corruption
toddmgreer 156fd57
Merge remote-tracking branch 'upstream/main' into ext_authz_caching
toddmgreer 7633dd3
style: fix style and formatting in ext_authz cache tests and headers
toddmgreer 8136cc9
ext_authz: Defer CheckRequest construction on cache hit.
toddmgreer 35e6325
docs: Update ext_authz caching documentation.
toddmgreer 3b71a6a
docs: Add invalid_cached_response stat back to docs.
toddmgreer 62a45fa
ext_authz: Remove raw_check_response from Response struct.
toddmgreer e20c7e6
ext_authz: rename processResponse to onComplete
toddmgreer de5ac03
ext_authz: Remove misleading comment in collectAttributes
toddmgreer 4646a34
style: fix formatting and proto imports in ext_authz
toddmgreer 0125d5e
api: add extension category for ext_authz cache
toddmgreer 6337add
Revert "api: add extension category for ext_authz cache"
toddmgreer 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| /api/bazel-* | ||
| /bazel-* | ||
| /ci/bazel-* | ||
| /docs/bazel-* | ||
| /mobile/bazel-* | ||
| bazel.output.txt | ||
| clang.bazelrc | ||
|
|
||
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,69 @@ | ||
| #pragma once | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "envoy/config/typed_config.h" | ||
| #include "envoy/http/filter.h" | ||
| #include "envoy/http/header_map.h" | ||
| #include "envoy/service/auth/v3/external_auth.pb.h" | ||
| #include "envoy/stream_info/stream_info.h" | ||
| #include "envoy/tracing/tracer.h" | ||
|
|
||
| #include "source/common/protobuf/protobuf.h" | ||
| #include "source/extensions/filters/common/ext_authz/ext_authz.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace HttpFilters { | ||
| namespace ExtAuthz { | ||
|
|
||
| struct RequestAttributes { | ||
| const Http::RequestHeaderMap& headers_; | ||
| Protobuf::Map<std::string, std::string> context_extensions_; | ||
| envoy::config::core::v3::Metadata metadata_context_; | ||
| envoy::config::core::v3::Metadata route_metadata_context_; | ||
| }; | ||
|
|
||
| class AuthCache { | ||
| public: | ||
| virtual ~AuthCache() = default; | ||
|
|
||
| using LookupCallback = std::function<void(Filters::Common::ExtAuthz::ResponsePtr&&)>; | ||
|
|
||
| /** | ||
| * Looks for a matching request/response pair in the cache. | ||
| * If lookup fails or misses, the callback should be invoked with nullptr. | ||
| * Lifetimes of the arguments passed to it must last until onDestroy is called. | ||
| * @param decoder_callbacks The stream decoder filter callbacks. | ||
| * @param attributes The RequestAttributes containing authorization context. | ||
| * @param cb The callback to invoke when the lookup completes. | ||
| */ | ||
| virtual void lookup(Http::StreamDecoderFilterCallbacks& decoder_callbacks, | ||
| const RequestAttributes& attributes, LookupCallback&& cb) = 0; | ||
|
|
||
| /** | ||
| * Inserts a response into the cache. | ||
| * @param response The Response received from the authz service. | ||
| */ | ||
| virtual void insert(const Filters::Common::ExtAuthz::Response& response) = 0; | ||
|
|
||
| /** | ||
| * Called when the filter is being destroyed. The cache implementation must | ||
| * abort any in-progress asynchronous operations before returning. | ||
| */ | ||
| virtual void onDestroy() = 0; | ||
| }; | ||
|
|
||
| using AuthCachePtr = std::unique_ptr<AuthCache>; | ||
|
|
||
| class AuthCacheFactory : public Config::TypedFactory { | ||
| public: | ||
| virtual AuthCachePtr createAuthCache(const Protobuf::Message& config, | ||
| Server::Configuration::ServerFactoryContext& context) = 0; | ||
| std::string category() const override { return "envoy.filters.http.ext_authz.cache"; } | ||
| }; | ||
|
|
||
| } // namespace ExtAuthz | ||
| } // namespace HttpFilters | ||
| } // namespace Extensions | ||
| } // namespace Envoy |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.