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

XSRF cookie path should be set to base_url instead of '/' #6278

Open
ykazakov opened this issue Jan 21, 2022 · 1 comment
Open

XSRF cookie path should be set to base_url instead of '/' #6278

ykazakov opened this issue Jan 21, 2022 · 1 comment

Comments

@ykazakov
Copy link

Describe the bug

When opening notebook in a browser, the _xsrf cookie is installed at the root path '/', which is also accessible from other services running on the same host. This can cause errors, for example when jupyter lab or other notebooks run on the same host.
See: jupyterhub/jupyterhub#3767

Instead, the cookie should be set for base_url, similarly as done for jupyter server by adding these lines to /notebook/notebookapp.py:

if base_url and "xsrf_cookie_kwargs" not in settings:
    # default: set xsrf cookie on base_url
    settings["xsrf_cookie_kwargs"] = {"path": base_url}

I can submit a PR if there is a chance that its going to be merged. ;-)

@minrk
Copy link
Member

minrk commented Jan 24, 2022

FWIW, this is already fixed in jupyter-server, so the same patch can be applied on this repo: jupyter-server/jupyter_server#612

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants