jwt_authn: support fetching jwks in the background#16298
jwt_authn: support fetching jwks in the background#16298lizan merged 21 commits intoenvoyproxy:mainfrom
Conversation
rojkov
left a comment
There was a problem hiding this comment.
Looks very good! I added a few nitpicking comments.
There was a problem hiding this comment.
nit: no need for this else branch.
There was a problem hiding this comment.
nit: setting debug_name_ could be done in the ctor init list. This way it could be marked as const.
There was a problem hiding this comment.
The callbacks can be marked as const.
There was a problem hiding this comment.
nit: create_fetcher_fn_ would be more readable.
There was a problem hiding this comment.
s/handle_fetch_done/handleFetchDone/
There was a problem hiding this comment.
We don't need this flag, it can be determined by whether the field async_fetch is set or not.
There was a problem hiding this comment.
Shall we reuse normal HTTP RetryPolicy here, and make HTTP Async Client aware of that?
There was a problem hiding this comment.
Good idea. I will add core.Retry config as part of RemoteJwks, Change common/JwksFetcher to support it.
That can be done as separate pr. The issue is tracked here
In this pr, I will remove retry
|
Can you check CI? @rojkov let me know once the implementation looks good to you, then I will take a second look. |
|
Tried to build docs locally. But run into this issue |
There was a problem hiding this comment.
Nit: Debug log the failure error reason?
There was a problem hiding this comment.
JwksFetcher has debug log. Not need to put here
There was a problem hiding this comment.
nit: is this if condition needed?
There was a problem hiding this comment.
It is safe to check. this is for the case neither local_jwks nor remote_jwks is set. of local_jwks is set, but somehow it is empty.
There was a problem hiding this comment.
nit: better stick to the same style for lambdas. Either like in this line or in the line 31.
|
Update: working on the jwt_authn:filter_integration_test failure. Added 4 AsyncFetch integration_tests. Two of them crashed with For now, it is not easy to debug such crash. My local development environment is not working. I have to use ci/run_envoy_docker. Not sure how to run gdb within docker. |
|
How do I run gdb for a bazel test target? especially inside docker, and inside ci_do.sh. For now, I can only produce this crash in Here is the backtrace: |
95c694d to
965523a
Compare
There was a problem hiding this comment.
This seems to be redundant: fetcher_ calls its cancel() method in its destructor.
There was a problem hiding this comment.
That is true, I can remove it.
|
/retest envoy-presubmit (check linux_x64 gcc) |
|
Retrying Azure Pipelines: |
|
test envoy-presubmit (check linux_x64 gcc) is failed du to following error: Not sure how to fix it. |
rojkov
left a comment
There was a problem hiding this comment.
Looks good, but could you get rid of the double definition of CreateJwksFetcherCb? Or at least give the types different names if you believe the types are fundamentally different.
|
Done. removed the double definitions. Thanks @rojkov |
|
check-format failed in pre-submit tests. The error is release note current.rst is out of order after merged with top of tree. Should I rebase this change to fix it? |
54a0b47 to
1925efc
Compare
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
1925efc to
453d8a9
Compare
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Signed-off-by: Wayne Zhang <qiwzhang@google.com>
Expose the Envoy configuration created here: envoyproxy/envoy#16298
* Add JwksAsyncFetch configuration Expose the Envoy configuration created here: envoyproxy/envoy#16298 * variable name * codegeen * Update jwt.proto * import definition of JwksAsyncFetch in config * don't import definition * define JwksAsyncFetch in config.proto
* Add JwksAsyncFetch configuration Expose the Envoy configuration created here: envoyproxy/envoy#16298 * variable name * codegeen * Update jwt.proto * import definition of JwksAsyncFetch in config * don't import definition * define JwksAsyncFetch in config.proto
* Add support for headerBodyRequestTransform property in aws destinationSpec * Add testing around new property * Document Local AWS config process * Add changelog entry * Merge branch 'master' into aws-lambda-header-body-request-transform * Add staged transformations * Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * Only apply transformation filter if transformations have been added * Add notes on debug workflow * Minor updates to extracted payload values * rename method to httpMethod * Merge refs/heads/master into aws-lambda-header-body-request-transform * Adding changelog file to new location * Deleting changelog file from old location * Respond to comments * git push Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * Add JwksAsyncFetch configuration (#5311) * Add JwksAsyncFetch configuration Expose the Envoy configuration created here: envoyproxy/envoy#16298 * variable name * codegeen * Update jwt.proto * import definition of JwksAsyncFetch in config * don't import definition * define JwksAsyncFetch in config.proto * Adding changelog file to new location * Deleting changelog file from old location * Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * extract early stage filter utility * Add sam's commentary on port 21001 to e2e README * Pass pointer to &transformationPlugin.RequireEarlyTransformation * Revert "extract early stage filter utility" This reverts commit a5ed578. * Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * Make earlyPluginStage private again * Update description + fieldname of request transformation option * Merge refs/heads/master into aws-lambda-header-body-request-transform * Update function signature of aws.NewPlugin in aws plugin test * Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * Remove log statements * Set regular transforms when request transformations are applied, use camelCase for queryString extractor * Merge refs/heads/master into aws-lambda-header-body-request-transform * Testing updates * Merge branch 'aws-lambda-header-body-request-transform' of github.com:solo-io/gloo into aws-lambda-header-body-request-transform * Remove transformation plugin RequireTransformationFilter property * Improve commentary around the use of earlyTransformsAdded property in aws plugin
It is to fix: envoyproxy#14556 (comment) Currently, remote Jwks is fetched on-demand, in the worker thread after the requests come. The first few requests need to pause to wait for the Jwks. Add a new feature to fetch remote Jwks in the main thread, before the listener is activated. Detail changes: * Change the filter config to add async_fetch field inside RemoteJwks message * Add a new class: JwksAsyncFetcher class to handle this new config. * Add two new statistics counters `jwks_fetch_success` and `jwks_fetch_fail`. Risk Level: Low since new feature is guarded by the new config. Testing: unit-tested and integration tested Docs Changes: None Release Notes: Yes Signed-off-by: Wayne Zhang <qiwzhang@google.com>
It is to fix: #14556 (comment)
Currently, remote Jwks is fetched on-demand, in the worker thread after the requests come. The first few requests need to pause to wait for the Jwks.
Add a new feature to fetch remote Jwks in the main thread, before the listener is activated.
Detail changes:
jwks_fetch_successandjwks_fetch_fail.Risk Level: Low since new feature is guarded by the new config.
Testing: unit-tested and integration tested
Docs Changes: None
Release Notes: Yes