Skip to content

[core] use AuthenticationValidator in Ray sync server#60779

Merged
edoakes merged 7 commits intoray-project:masterfrom
andrewsykim:ray-sync-server-auth-fix
Feb 6, 2026
Merged

[core] use AuthenticationValidator in Ray sync server#60779
edoakes merged 7 commits intoray-project:masterfrom
andrewsykim:ray-sync-server-auth-fix

Conversation

@andrewsykim
Copy link
Member

Description

This is a bug fix to Ray sync server to use authentication token validator which will delegate token auth to Kubernetes if Ray is configured to do so.

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

@andrewsykim andrewsykim requested a review from a team as a code owner February 5, 2026 18:54
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Ray sync server to use AuthenticationTokenValidator for token validation, which is a good step towards centralizing authentication logic and enabling features like Kubernetes token delegation. The changes correctly plumb the validator through to where it's needed.

However, I've found a critical issue in the implementation. The new validation logic is wrapped in a condition that prevents it from running when Kubernetes authentication is enabled, effectively bypassing security checks. I've left a detailed comment with a suggested fix. Please address this to ensure the authentication works as intended.

@ray-gardener ray-gardener bot added the community-contribution Contributed by the community label Feb 5, 2026
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Feb 5, 2026
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
@andrewsykim andrewsykim force-pushed the ray-sync-server-auth-fix branch from 34a9f20 to 092dca6 Compare February 6, 2026 03:21
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

const std::string_view header(it->second.data(), it->second.length());

if (!auth_token_->CompareWithMetadata(header)) {
if (!auth_token_validator_.ValidateToken(auth_token_, header)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description lacks explanation of problem being fixed

Low 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.

⚠️ This PR needs a clearer title and/or description.

To help reviewers, please ensure your PR includes:

  • Title: A concise summary of the change
  • Description:
    • What problem does this solve?
    • How does this PR solve it?
    • Any relevant context for reviewers such as:
      • Why is the problem important to solve?
      • Why was this approach chosen over others?

See this list of PRs as examples for PRs that have gone above and beyond:

Fix in Cursor Fix in Web

std::shared_ptr<const ray::rpc::AuthenticationToken> auth_token_;

// Validator for authentication token
ray::rpc::AuthenticationTokenValidator &auth_token_validator_;
Copy link
Contributor

@sampan-s-nayak sampan-s-nayak Feb 6, 2026

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?

Copy link
Contributor

@sampan-s-nayak sampan-s-nayak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this! I think we can release this as it is, but in a future pr we should consider skipping token loading

rpc_server_.RegisterService(std::make_unique<syncer::RaySyncerService>(
*ray_syncer_, ray::rpc::AuthenticationTokenLoader::instance().GetToken()));
}
if k8sTokenAuthMode is enabled as this token will not really be used and this ends up being a wasted call.

@edoakes edoakes merged commit a687ba4 into ray-project:master Feb 6, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray fails to serialize self-reference objects

3 participants