client/v3: do not overwrite authTokenBundle on dial#12992
client/v3: do not overwrite authTokenBundle on dial#12992ptabor merged 1 commit intoetcd-io:mainfrom awly:client-auth-bundle-overwrite
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12992 +/- ##
===========================================
- Coverage 55.29% 42.72% -12.57%
===========================================
Files 429 413 -16
Lines 33181 33221 +40
===========================================
- Hits 18346 14193 -4153
- Misses 13102 17121 +4019
- Partials 1733 1907 +174
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
ptabor
left a comment
There was a problem hiding this comment.
Thank you. Could you, please, add a regression test for the new behavior.
|
@ptabor sorry for the delay, added a test. |
`Client.dial` can be called multiple times. For example, from regular `NewClient` and [from the `Maintenance` wrapper](https://github.com/etcd-io/etcd/blob/6d451ab61d2da992622b3e7dbf85ded04ebcc515/client/v3/maintenance.go#L81-L84). This ends up creating two (if `Client.dial` is called twice) independent `credentials.Bundle` instances: - the first one is wired into `PerRPCCredentials` callback in gRPC client. - the second one is in `Client.authTokenBundle` and receives the latest auth token updates. When using username/password authentication and the server is configured to issue JWTs, token rotation logic breaks because of the above `credentials.Bundle` confusion.
|
@ptabor could you merge this please? |
|
@ptabor how do you think, is it possible to make a backport to 3.5 for this fix? For cluster with enable auth this bug is quite annoying and hard to workaround without hot patching. |
Cherry pick the PR etcd-io#12992 to 3.5, so please refer to the original PR for more detailed info. Signed-off-by: Benjamin Wang <[email protected]>
Cherry pick the PR etcd-io#12992 to 3.5, so please refer to the original PR for more detailed info. Signed-off-by: Benjamin Wang <[email protected]>
Cherry pick the PR etcd-io#12992 to 3.5, so please refer to the original PR for more detailed info. Signed-off-by: Benjamin Wang <[email protected]>
Cherry pick the PR etcd-io#12992 to 3.5, so please refer to the original PR for more detailed info. Signed-off-by: Benjamin Wang <[email protected]>
Client.dialcan be called multiple times. For example, from regularNewClientand from theMaintenancewrapper.
This ends up creating two (if
Client.dialis called twice) independentcredentials.Bundleinstances:PerRPCCredentialscallback in gRPCclient.
Client.authTokenBundleand receives the latestauth token updates.
When using username/password authentication and the server is configured
to issue JWTs, token rotation logic breaks because of the above
credentials.Bundleconfusion.As a simple solution, do not overwrite
Client.authTokenBundleif it's already set.Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.