-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[core] use AuthenticationValidator in Ray sync server #60779
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
Changes from all commits
165361c
4a8c5d4
a58175f
e203a5c
159399e
cb7608a
092dca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| #include <utility> | ||
|
|
||
| #include "ray/common/constants.h" | ||
| #include "ray/rpc/authentication/authentication_mode.h" | ||
|
|
||
| namespace ray::syncer { | ||
|
|
||
|
|
@@ -39,6 +40,7 @@ RayServerBidiReactor::RayServerBidiReactor( | |
| std::function<void(std::shared_ptr<const RaySyncMessage>)> message_processor, | ||
| std::function<void(RaySyncerBidiReactor *, bool)> cleanup_cb, | ||
| std::shared_ptr<const ray::rpc::AuthenticationToken> auth_token, | ||
| ray::rpc::AuthenticationTokenValidator &auth_token_validator, | ||
| size_t max_batch_size, | ||
| uint64_t max_batch_delay_ms) | ||
| : RaySyncerBidiReactorBase<ServerBidiReactor>( | ||
|
|
@@ -49,8 +51,9 @@ RayServerBidiReactor::RayServerBidiReactor( | |
| max_batch_delay_ms), | ||
| cleanup_cb_(std::move(cleanup_cb)), | ||
| server_context_(server_context), | ||
| auth_token_(std::move(auth_token)) { | ||
| if (auth_token_ && !auth_token_->empty()) { | ||
| auth_token_(std::move(auth_token)), | ||
| auth_token_validator_(auth_token_validator) { | ||
| if ((auth_token_ && !auth_token_->empty()) || ray::rpc::IsK8sTokenAuthEnabled()) { | ||
| // Validate authentication token | ||
| const auto &metadata = server_context->client_metadata(); | ||
| auto it = metadata.find(kAuthTokenKey); | ||
|
|
@@ -64,7 +67,7 @@ RayServerBidiReactor::RayServerBidiReactor( | |
|
|
||
| const std::string_view header(it->second.data(), it->second.length()); | ||
|
|
||
| if (!auth_token_->CompareWithMetadata(header)) { | ||
| if (!auth_token_validator_.ValidateToken(auth_token_, header)) { | ||
andrewsykim marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR description lacks explanation of problem being fixedLow Severity The PR description states "This is a bug fix to Ray sync server to use authentication token validator" but doesn't explain what problem was present. It explains how the fix works (delegating to Kubernetes) but not what issue the code had before. For example, was token validation failing entirely? Was K8s authentication not being checked? The description needs a sentence explaining the actual problem. To help reviewers, please ensure your PR includes:
See this list of PRs as examples for PRs that have gone above and beyond:
|
||
| RAY_LOG(WARNING) << "Invalid bearer token in syncer connection from node " | ||
| << NodeID::FromBinary(GetRemoteNodeID()); | ||
| Finish(grpc::Status(grpc::StatusCode::UNAUTHENTICATED, "Invalid bearer token")); | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.
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.
any specific reason to pass and store this instance? why not just call
ray::rpc::AuthenticationTokenValidator::instance()wherever required?