-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
clientv3: get AuthToken automatically when clientConn is ready. #12264
Conversation
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.
LGTM other than the logging part, thanks! The failed test seems to be non deterministic.
clientv3/retry_interceptor.go
Outdated
} | ||
creds = c.authTokenBundle.PerRPCCredentials() | ||
} | ||
if creds != nil { |
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 think logging metadata wouldn't be good, it can expose a credential in client side logs, right?
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.
Thanks, But I think that no other credential info in client side logs in
etcd/clientv3/credentials/credentials.go
Lines 110 to 115 in 76e769c
func (rc *perRPCCredential) GetRequestMetadata(ctx context.Context, s ...string) (map[string]string, error) { | |
rc.authTokenMu.RLock() | |
authToken := rc.authToken | |
rc.authTokenMu.RUnlock() | |
return map[string]string{rpctypes.TokenFieldNameGRPC: authToken}, nil | |
} |
authToken
only, there is not other keyword. Logging metadata for debug .
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.
yeah, but if the token can be leaked and malicious person can get it, it can result security issue. I think it shouldn't be logged. How do you think?
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.
emmm, you are right.
I fixed it at 0649f91 .
but CI was failed at https://travis-ci.com/github/etcd-io/etcd/jobs/385106741#L2064 .
=== RUN TestBalancerUnderNetworkPartitionWatchLeader
TestBalancerUnderNetworkPartitionWatchLeader: network_partition_test.go:266: took too long to detect leader lost
--- FAIL: TestBalancerUnderNetworkPartitionWatchLeader (3.35s)
But ,I test passed on my macbook like this:
$ PASSES=integration TESTCASE=TestBalancerUnderNetworkPartitionWatchLeader ./test [015eab45e]
Running with TEST_CPUS: 1,2,4
Starting 'integration' pass at 2020年 9月16日 星期三 12时26分27秒 CST
Running integration tests...
testing: warning: no tests to run
PASS
ok go.etcd.io/etcd/v3/integration 0.017s [no tests to run]
testing: warning: no tests to run
PASS
ok go.etcd.io/etcd/v3/client/integration 0.026s [no tests to run]
=== RUN TestBalancerUnderNetworkPartitionWatchLeader
--- PASS: TestBalancerUnderNetworkPartitionWatchLeader (1.65s)
=== RUN TestBalancerUnderNetworkPartitionWatchLeader
--- PASS: TestBalancerUnderNetworkPartitionWatchLeader (1.40s)
=== RUN TestBalancerUnderNetworkPartitionWatchLeader
--- PASS: TestBalancerUnderNetworkPartitionWatchLeader (1.23s)
PASS
ok go.etcd.io/etcd/v3/clientv3/integration 4.306s
testing: warning: no tests to run
PASS
ok go.etcd.io/etcd/v3/contrib/raftexample 0.013s [no tests to run]
Finished 'integration' pass at 2020年 9月16日 星期三 12时26分45秒 CST
Success
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.
CI works. thank you. @mitake
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.
LGTM, thanks!
…upstream-release-3.4 Automated cherry pick of #12264
…upstream-release-3.3 Automated cherry pick of #12264
Old etcdserver which have not apply pr of etcd-io#12165 will check auth token even if the request is a Authenticate request. If the client has a invalid auth token, it will not able to update it's token, since the Authenticate has a invalid auth token. This fix clear the auth token when encounter an ErrInvalidAuthToken to talk with old version etcd servers. Fix etcd-io#12385 with etcd-io#12165 and etcd-io#12264
Old etcdserver which have not apply pr of etcd-io#12165 will check auth token even if the request is a Authenticate request. If the client has a invalid auth token, it will not able to update it's token, since the Authenticate has a invalid auth token. This fix clear the auth token when encounter an ErrInvalidAuthToken to talk with old version etcd servers. Fix etcd-io#12385 with etcd-io#12165 and etcd-io#12264
Old etcdserver which have not apply pr of etcd-io#12165 will check auth token even if the request is an Authenticate request. If the client has a invalid auth token, it will not able to update it's token, since the Authenticate has a invalid auth token. This fix clear the auth token when encounter an ErrInvalidAuthToken to talk with old version etcd servers. Fix etcd-io#12385 with etcd-io#12165 and etcd-io#12264
Old etcdserver which have not apply pr of etcd-io#12165 will check auth token even if the request is an Authenticate request. If the client has a invalid auth token, it will not able to update it's token, since the Authenticate has a invalid auth token. This fix clear the auth token when encounter an ErrInvalidAuthToken to talk with old version etcd servers. Fix etcd-io#12385 with etcd-io#12165 and etcd-io#12264
Old etcdserver which have not apply pr of etcd-io#12165 will check auth token even if the request is an Authenticate request. If the client has a invalid auth token, it will not able to update it's token, since the Authenticate has a invalid auth token. This fix clear the auth token when encounter an ErrInvalidAuthToken to talk with old version etcd servers. Fix etcd-io#12385 with etcd-io#12165 and etcd-io#12264
clientv3: get AuthToken automatically when clientConn is ready.
fixes: #11954