-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Authenticate method improvements #15734
Conversation
Previously-connected clients will have a NodeID set on the context, and because this is a large portion of the RPCs sent we fast-pathed it at the top of the `Authenticate` method. But the context is shared for all yamux streams over the same yamux session (and TCP connection). This lets an authenticated HTTP request to a client use the NodeID for authentication, which is a privilege escalation. Remove the fast path and annotate it so that we don't break it again.
The `Authenticate` method taken on its own looks like it wants to return an `acl.ACL` that folds over all the various identity types (creating an ephemeral ACL on the fly if neccessary). But keeping these fields idependent allows RPC handlers to differentiate between internal and external origins so we most likely want to avoid this. Leave some docstrings as a warning as to why this is built the way it is.
When reviewing #15513 we decided that forcing the request handler to call `SetIdentity` was repetitive and error prone. Instead, the `Authenticate` method mutates the request by setting its `AuthenticatedIdentity`.
5a9c2ef
to
f763920
Compare
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
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!
Co-authored-by: James Rasell <[email protected]>
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This changeset covers a sidebar discussion that @schmichael and I had around the
design for pre-forwarding auth. This includes some changes extracted out of
#15513 to make it easier to review both and leave a clean history.
Remove fast path for NodeID: Previously-connected clients will have a NodeID
set on the context, and because this is a large portion of the RPCs sent we
fast-pathed it at the top of the
Authenticate
method. But the context isshared for all yamux streams over the same yamux session (and TCP
connection). This lets an authenticated HTTP request to a client use the NodeID
for authentication, which is a privilege escalation. Remove the fast path and
annotate it so that we don't break it again.
Add context to decisions. The
Authenticate
method taken on its own lookslike it wants to return an
acl.ACL
that folds over all the various identitytypes (creating an ephemeral ACL on the fly if neccessary). But keeping these
fields idependent allows RPC handlers to differentiate between internal and
external origins so we most likely want to avoid this. Leave some docstrings as
a warning as to why this is built the way it is.
Mutate the request rather than returning a value. When reviewing implement pre-forwarding auth on select RPCs #15513 we
decided that forcing the request handler to call
SetIdentity
was repetitiveand error prone. Instead, the
Authenticate
method mutates the request bysetting its
AuthenticatedIdentity
.I'm marking folks other than @schmichael for review on this as he's discussed these changes with me already but isn't going to be available for a review this week, so spreading the design decisions around seems like a good idea.