-
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
auth: context.WithValue has string type keys #8826
Comments
@gyuho I didn't know the keys should have its own type, thanks for letting me know. We don't have keys other than the two. BTW we are using context instead of a custom struct for passing the parameters for reducing dependencies from etcdserver to auth (the result of offline discussion with @xiang90 ). But if we need custom types for the params, it must introduce such a dependency between the packages. So I think that stopping using context and introduce a struct for the parameter would be fine. How do you think? @xiang90 |
@gyuho yes, in such a case, the definition of BTW do we need to care about the backward compatibility between packages which cannot be seen from external ones? Also, the code of |
@mitake Oh, somehow I was thinking context passed from other servers (where we need worry about compatibilities against older versions). But in this case, the context only goes from etcdserver to auth package, and never goes to other servers. So breaking change should be fine.
Agree.
I see. Then, proxy should fine, as it is now. |
@gyuho I tried to eliminate context styled parameter passing from etcdserver to auth, but found that it is quite useful for |
The keys of context shouldn't be string. They should be a struct of their own type. Fix etcd-io#8826
The keys of context shouldn't be string. They should be a struct of their own type. Fix etcd-io#8826
https://github.com/coreos/etcd/blob/1d01aaa3958069e062805edd808b4658e1a04133/auth/store.go#L1066-L1073
From #8031.
https://github.com/coreos/etcd/blob/5ed5ee51f57a635c84acde19d96c288f57d1754a/proxy/grpcproxy/util.go#L35-L38
The key should have been typed (e.g.
keyABC{}
), rather than string.Otherwise, it could collide with other keys (e.g. tracing).
"index"
and"simpleToken"
have not been released yet, so should be safe to change.Do we have any other string context keys in 3.2? /cc @mitake
UPDATE: might need handle 3.1 #5672 compatibility as well.
The text was updated successfully, but these errors were encountered: