Skip to content
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

[Dashboard] Error 403 for ray dashboard on localhost in ray 2.8.0 #41379

Closed
PhilippWillms opened this issue Nov 25, 2023 · 2 comments · Fixed by #41388
Closed

[Dashboard] Error 403 for ray dashboard on localhost in ray 2.8.0 #41379

PhilippWillms opened this issue Nov 25, 2023 · 2 comments · Fixed by #41388
Labels
bug Something that is supposed to be working; but isn't dashboard Issues specific to the Ray Dashboard triage Needs triage (eg: priority, bug/not-bug, and owning component) windows

Comments

@PhilippWillms
Copy link

What happened + What you expected to happen

Hello,
after installing ray 2.8.0 in Python 3.10.13 on Windows 11, I get working processes and job, but dashboard seems to be broken.

Behavior is kind of strange, as the classic address 127.0.0.1:8265 shows signal but only in the form of an empty / white page. Digging deeper in dev console, I can drill it down to the following two error messages:

GET http://127.0.0.1:8265/static/js/main.4e04a38d.js net::ERR_ABORTED 403 (Forbidden)
GET http://127.0.0.1:8265/static/css/main.388a904b.css net::ERR_ABORTED 403 (Forbidden)

Versions / Dependencies

ray==2.8.0
Python=3.10.13
Windows = 10.0.22631 Build 22631

Reproduction script

$ pip install "ray[dashboard, rllib, tune]==2.8.0"
$ ray start --head

Open http://127.0.0.1:8265 in any browser.

Issue Severity

Medium: It is a significant difficulty but I can work around it.

@PhilippWillms PhilippWillms added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Nov 25, 2023
@mattip
Copy link
Contributor

mattip commented Nov 26, 2023

xref the discussion on https://discuss.ray.io/t/error-403-for-ray-dashboard-on-localhost-in-ray-2-8-0-on-windows11/12717

The problem came from #39018 where it is assumed that a path like /static/* can be converted via pathlib.resolve() to see if it is outside parent. These lines don't work as desired on windows, note the excess C:

# If the destination is not relative to the expected directory,
# then the user is attempting path traversal, so deny the request.
request_path = pathlib.Path(request.path).resolve()
if request_path != parent and parent not in request_path.parents:
raise aiohttp.web.HTTPForbidden()
return await handler(request)

variable example
request.path /static/js/main.4e04a38d.js
request_path WindowsPath('C:/static/css/main.388a904b.css')
parent WindowsPath('/static')

I debugged this by adding some logging before raising the error, which seems like it might help in general:

logger.info(f"FORBIDDEN: {request.path=} became {request_path=} != {parent=}")

cc @ijrsvt

@ijrsvt
Copy link
Contributor

ijrsvt commented Nov 27, 2023

Hey @PhilippWillms Thanks so much for pointing this out! I completely forgot that Pathlib Paths directly interact with the underlying FileSystem. I think I just need to switch from a Path to a PurePosixPath and using posix-specific resolution!

@mattip mattip added dashboard Issues specific to the Ray Dashboard windows labels Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't dashboard Issues specific to the Ray Dashboard triage Needs triage (eg: priority, bug/not-bug, and owning component) windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants