Skip to content

[dashboard] mask password arguments in get_entrypoint_name() to prevent password exposure#61995

Merged
edoakes merged 3 commits into
ray-project:masterfrom
pedrojeronim0:fix/56927-redis-password-exposed
Apr 12, 2026
Merged

[dashboard] mask password arguments in get_entrypoint_name() to prevent password exposure#61995
edoakes merged 3 commits into
ray-project:masterfrom
pedrojeronim0:fix/56927-redis-password-exposed

Conversation

@pedrojeronim0

Copy link
Copy Markdown
Contributor

Description

Mask any process argument matching --[\w-]*password=<value> in get_entrypoint_name()
to prevent passwords from being exposed in the Ray dashboard.

  • Verified with ruff linter.
  • Added test to verify password values are not exposed in the output of get_entrypoint_name().
  • Verified that test_job.py which contains test_get_entrypoint passes.

Related issues

Fixes #56927

Additional information

The entrypoint was being sent to the GCS with sensitive arguments exposed.
This was then reflected in the Ray dashboard, leaking password values.

Before
After

@pedrojeronim0 pedrojeronim0 requested a review from a team as a code owner March 23, 2026 21:57

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

Copy link
Copy Markdown
Contributor

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 introduces a security enhancement to mask password arguments in get_entrypoint_name(), preventing them from being exposed in the Ray dashboard. The implementation correctly handles arguments in the format --key=value. I've suggested an improvement to also handle the --key value format for more comprehensive protection. Additionally, I've recommended adding a corresponding test case to ensure both formats are properly masked.

Comment thread python/ray/_private/utils.py Outdated
Comment on lines +1523 to +1526
sanitized = [
re.sub(r"(--[\w-]*password=).*", r"\1****", arg) for arg in curr.cmdline()
]
return prefix + list2cmdline(sanitized)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The current implementation only masks passwords provided in the --key=value format. It would be more robust to also handle passwords passed in the --key value format (e.g., --password mysecret). This change enhances security by covering another common way of passing sensitive information via command-line arguments.

Suggested change
sanitized = [
re.sub(r"(--[\w-]*password=).*", r"\1****", arg) for arg in curr.cmdline()
]
return prefix + list2cmdline(sanitized)
cmd_line = curr.cmdline()
sanitized = []
i = 0
while i < len(cmd_line):
arg = cmd_line[i]
# Mask arguments in the form --key=value
new_arg = re.sub(r"(--[\w-]*password=).*", r"\1****", arg)
if new_arg != arg:
sanitized.append(new_arg)
i += 1
# Mask arguments in the form --key value
elif re.match(r"--[\w-]*password$", arg) and i + 1 < len(cmd_line) and not cmd_line[i + 1].startswith("-"):
sanitized.append(arg)
sanitized.append("****")
i += 2
else:
sanitized.append(arg)
i += 1
return prefix + list2cmdline(sanitized)
Comment thread python/ray/tests/test_job.py Outdated
assert line_exists(
outputs, f"result: {sys.executable} {fp} --redis-password=\\*\\*\\*\\*"
)
assert not any("secret123" in line for line in outputs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To ensure the password masking is robust, it's a good idea to add a test case for passwords passed in the --key value format. This will verify that both common argument styles are handled correctly.

Suggested change
assert not any("secret123" in line for line in outputs)
assert not any("secret123" in line for line in outputs)
# Test that password arguments with a space are also masked.
outputs = execute_driver([sys.executable, str(fp), "--another-password", "secret456"])
assert line_exists(
outputs, f"result: {sys.executable} {fp} --another-password \*\*\*\*"
)
assert not any("secret456" in line for line in outputs)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

Comment thread ci/ray_ci/automation/get_contributors.py Outdated
password exposure

Mask any process argument matching --[\w-]*password=<value> in
get_entrypoint_name() to prevent passwords from being exposed in the Ray
dashboard. The entrypoint was being sent to the GCS with sensitive
arguments exposed. This was then reflected in the Ray dashboard, leaking
password values.

Fixes ray-project#56927

Signed-off-by: Pedro Jeronimo <pedro.jeronimo@tecnico.ulisboa.pt>
@pedrojeronim0 pedrojeronim0 force-pushed the fix/56927-redis-password-exposed branch from eff6631 to 74eae17 Compare March 23, 2026 22:11
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling community-contribution Contributed by the community labels Mar 24, 2026
@aslonnie aslonnie removed request for a team March 24, 2026 19:51
@aslonnie aslonnie removed request for a team and aslonnie March 24, 2026 19:51
@edoakes

edoakes commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

This solution looks quite brittle. Could we instead just avoid passing the password as a CLI argument? It could be passed as an environment variable instead, for example.

@aslonnie aslonnie self-requested a review March 27, 2026 02:56
@pedrojeronim0

Copy link
Copy Markdown
Contributor Author

This solution looks quite brittle. Could we instead just avoid passing the password as a CLI argument? It could be passed as an environment variable instead, for example.

Thanks for the feedback, @edoakes ! You're right, passing the Redis password via an environment variable is a cleaner and more robust solution. I'll update the implementation accordingly and drop the masking approach.

I'll keep the CLI argument option for retro-compatibility, marking it as deprecated. If provided, it will set the environment variable early (if not already set), so it doesn't get propagated to subprocesses as an argument, showing up in places like get_entrypoint_name(). Does that sound reasonable, or would you prefer we remove the CLI argument entirely?

@edoakes

edoakes commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

I'll keep the CLI argument option for retro-compatibility, marking it as deprecated. If provided, it will set the environment variable early (if not already set), so it doesn't get propagated to subprocesses as an argument, showing up in places like get_entrypoint_name(). Does that sound reasonable, or would you prefer we remove the CLI argument entirely?

Directly removing the argument should be fine as this is an internal API (I don't expect anyone to be starting this server on their own manually). Here is the entrypoint:

parser.add_argument(

@aslonnie aslonnie removed their request for review March 27, 2026 22:45
@pedrojeronim0

Copy link
Copy Markdown
Contributor Author

I'll keep the CLI argument option for retro-compatibility, marking it as deprecated. If provided, it will set the environment variable early (if not already set), so it doesn't get propagated to subprocesses as an argument, showing up in places like get_entrypoint_name(). Does that sound reasonable, or would you prefer we remove the CLI argument entirely?

Directly removing the argument should be fine as this is an internal API (I don't expect anyone to be starting this server on their own manually). Here is the entrypoint:

parser.add_argument(

Ah got it, thanks for the clarification @edoakes ! I was initially thinking about a more general change at the ray start level, but your suggestion makes sense and is more targeted.

I'll go ahead and remove the argument from the client server entrypoint and rely on the environment variable there instead.

@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Mar 30, 2026
…iable

Stop passing the redis password to the ray client server as a CLI argument.
It was being exposed in the job entrypoint shown in the dashboard.
Use an environment variable instead to prevent this exposure.

Fixes ray-project#56927

Signed-off-by: Pedro Jeronimo <pedro.jeronimo@tecnico.ulisboa.pt>
@pedrojeronim0

Copy link
Copy Markdown
Contributor Author

Hey @edoakes ! I just committed the discussed changes. Let me know what you think!

Now the redis password no longer appears in the job entrypoint.
image

@edoakes edoakes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, minor comments

Comment thread python/ray/tests/test_client_proxy.py
Comment thread python/ray/_private/services.py
Signed-off-by: Pedro Jeronimo <pedro.jeronimo@tecnico.ulisboa.pt>
@edoakes edoakes enabled auto-merge (squash) April 3, 2026 22:57
@pedrojeronim0

Copy link
Copy Markdown
Contributor Author

Hey @edoakes !
I noticed auto-merge was enabled for my PR last week, but it still hasn’t been merged.

I saw that the buildkite/premerge is currently failing due to a dependency resolution error. I looked into it briefly, and it doesn’t seem related to my changes.

Just wanted to check if there’s anything I should do on my side. Thanks!

@edoakes edoakes disabled auto-merge April 12, 2026 02:20
@edoakes edoakes merged commit e0c2c53 into ray-project:master Apr 12, 2026
6 of 7 checks passed
@edoakes

edoakes commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

@pedrojeronim0 just merged it. Thanks for the contribution and the reminder!

HLDKNotFound pushed a commit to chichic21039/ray that referenced this pull request Apr 22, 2026
…nt password exposure (ray-project#61995)

Mask any process argument matching `--[\w-]*password=<value>` in
get_entrypoint_name()
to prevent passwords from being exposed in the Ray dashboard.

- [x] Verified with ruff linter.
- [x] Added test to verify password values are not exposed in the output
of get_entrypoint_name().
- [x] Verified that test_job.py which contains test_get_entrypoint
passes.

## Related issues
Fixes ray-project#56927

## Additional information
The entrypoint was being sent to the GCS with sensitive arguments
exposed.
This was then reflected in the Ray dashboard, leaking password values.


![Before](https://github.com/user-attachments/assets/f80499b1-a73a-4ffc-95a6-ab773c0823e5)

![After](https://github.com/user-attachments/assets/ffd5ecec-5e69-4554-8ca9-1a41f2365cf0)

---------

Signed-off-by: Pedro Jeronimo <pedro.jeronimo@tecnico.ulisboa.pt>
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…nt password exposure (ray-project#61995)

Mask any process argument matching `--[\w-]*password=<value>` in
get_entrypoint_name()
to prevent passwords from being exposed in the Ray dashboard.

- [x] Verified with ruff linter.
- [x] Added test to verify password values are not exposed in the output
of get_entrypoint_name().
- [x] Verified that test_job.py which contains test_get_entrypoint
passes.

## Related issues
Fixes ray-project#56927

## Additional information
The entrypoint was being sent to the GCS with sensitive arguments
exposed.
This was then reflected in the Ray dashboard, leaking password values.


![Before](https://github.com/user-attachments/assets/f80499b1-a73a-4ffc-95a6-ab773c0823e5)

![After](https://github.com/user-attachments/assets/ffd5ecec-5e69-4554-8ca9-1a41f2365cf0)

---------

Signed-off-by: Pedro Jeronimo <pedro.jeronimo@tecnico.ulisboa.pt>
@anhpham1509

Copy link
Copy Markdown

Hi @edoakes , I saw the PR is already merged. Are you planning to release this soon in the next version?

@edoakes

edoakes commented May 28, 2026

Copy link
Copy Markdown
Collaborator

@anhpham1509 we are cutting a release branch imminently. The release should go out next week.

@anhpham1509

Copy link
Copy Markdown

@edoakes Hello, just want to catch up on the release progress. It's few week drifted and I haven't seen a new release.

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 core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling

3 participants