-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
credentials/alts: Initial version of ALTS code #1865
Conversation
f37b648
to
a5282b9
Compare
Any documentation? |
@therc This code is for silent launch. The code is not ready for public consumption yet. Hopefully soon. Once we are beta launch, we will provide corresponding public user guide. |
@jiangtaoli2016 I see, thanks. Also, another suggestion for the whitepaper: a section on "Why not Kerberos?". I think I know some of the reasons, but others are bound to ask the same question. |
Only looked at Reviewed 2 of 31 files at r1. credentials/alts/alts.go, line 22 at r1 (raw file):
Declare this package as experimental? credentials/alts/alts.go, line 53 at r1 (raw file):
What's the purpose of this flag? Also, I kind of don't like the idea of adding a flag for it. credentials/alts/alts.go, line 62 at r1 (raw file):
Should we add to the comment that: This interface is to be implemented by alts. Users should not need a credentials/alts/alts.go, line 80 at r1 (raw file):
Nit: this still says "Google Transport Security". credentials/alts/alts.go, line 129 at r1 (raw file):
Make a static variable for versions struct so we don't need to re-create it every time? credentials/alts/alts.go, line 139 at r1 (raw file):
Will Also see #1854 for possible leaks on streaming RPCs. credentials/alts/alts.go, line 151 at r1 (raw file):
Does the underlying handshaker need the IMO the check should happen before we create the credentials/alts/alts.go, line 173 at r1 (raw file):
Make a static variable? credentials/alts/alts.go, line 183 at r1 (raw file):
Similar to client side, credentials/alts/alts.go, line 195 at r1 (raw file):
Similar to client side on where the check should happen. credentials/alts/utils.go, line 53 at r1 (raw file):
Nit: rename this function to something more meaningful. credentials/alts/utils.go, line 86 at r1 (raw file):
This fatal will print the error returned by credentials/alts/utils.go, line 99 at r1 (raw file):
Why is this a Comments from Reviewable |
Thanks for the review Menghan. All comments are addressed. Review status: 2 of 31 files reviewed at latest revision, 13 unresolved discussions. credentials/alts/alts.go, line 22 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 53 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Ack! credentials/alts/alts.go, line 62 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 80 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Good catch, thanks! credentials/alts/alts.go, line 129 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 139 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 151 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Ack! credentials/alts/alts.go, line 173 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 183 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/alts.go, line 195 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Ack! credentials/alts/utils.go, line 53 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/utils.go, line 86 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. credentials/alts/utils.go, line 99 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. Comments from Reviewable |
d0c3def
to
41d49ad
Compare
Review status: 0 of 31 files reviewed at latest revision, 4 unresolved discussions. credentials/alts/alts.go, line 87 at r3 (raw file):
Will we want to extend the return value? credentials/alts/alts.go, line 91 at r3 (raw file):
All functions in this interface will be exposed to users, including this one. This function is needed by Will users also need this? If no, this should be moved to a separate (probably also unexported) interface. credentials/alts/alts.go, line 131 at r3 (raw file):
Should this be moved to
credentials/alts/utils.go, line 78 at r3 (raw file):
Also move this into the sync.Once? Otherwise if users import but don't use alts, they may still get Comments from Reviewable |
Review status: 0 of 31 files reviewed at latest revision, 4 unresolved discussions. credentials/alts/alts.go, line 87 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
ServiceAccount is just a string, usually it's an email address or some other identifier. credentials/alts/alts.go, line 91 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
All the functions in this interface might be used for the user for logging purposes or to check whether a specific RPC was actually executed as expected. We need all of them to be exported. credentials/alts/alts.go, line 131 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
Good call. Done. credentials/alts/utils.go, line 78 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
I'm not sure I'm following. Do you mean that calling isRunningOnGCP should be called in a once.Do? Should this be in init()? Comments from Reviewable |
Review status: 0 of 31 files reviewed at latest revision, 4 unresolved discussions. credentials/alts/utils.go, line 78 at r3 (raw file): Previously, cesarghali (Cesar Ghali) wrote…
isRunningOnGCP was actually in init() but now I remember why I moved it here, it was one of Doug's suggestions :) Comments from Reviewable |
Reviewed 1 of 1 files at r4. credentials/alts/utils.go, line 78 at r3 (raw file): Previously, cesarghali (Cesar Ghali) wrote…
I meant moving this to the same sync once for Comments from Reviewable |
Review status: 0 of 31 files reviewed at latest revision, 1 unresolved discussion. credentials/alts/utils.go, line 78 at r3 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. Comments from Reviewable |
Review status: 0 of 31 files reviewed at latest revision, 1 unresolved discussion. credentials/alts/alts.go, line 117 at r5 (raw file):
Hmm, this is not thread safe... Comments from Reviewable |
Review status: 0 of 31 files reviewed at latest revision, 1 unresolved discussion. credentials/alts/alts.go, line 117 at r5 (raw file): Previously, menghanl (Menghan Li) wrote…
My understanding is that Do blocks if it's called multiple times and only the first time will trigger the function: Comments from Reviewable |
credentials/alts/alts.go, line 117 at r5 (raw file): Previously, cesarghali (Cesar Ghali) wrote…
OK, right. I missed that. Comments from Reviewable |
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.
One minor thing I noticed; otherwise LGTM.
credentials/alts/alts.go
Outdated
func compareRPCVersions(v1, v2 *altspb.RpcProtocolVersions_Version) int { | ||
switch { | ||
case v1.GetMajor() > v2.GetMajor(): | ||
fallthrough |
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.
case a, b:
return 1
or
case a,
b:
return 1
(if you like the way that looks better.)
credentials/alts/alts.go
Outdated
case v1.GetMajor() == v2.GetMajor() && v1.GetMinor() > v2.GetMinor(): | ||
return 1 | ||
} | ||
switch { |
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.
Delete this line and the one above; the case statements can be in one switch.
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 don't even know how this code ended up with two switches :)
Fixed now.
299ab9a
to
8194973
Compare
Add support for Google's Application Layer Transport Protocol as a gRPC transport layer protocol.
For more information read the Application Layer Transport Protocol whitepaper:
https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security/
This change is