I’m trying to secure the xsrf cookie passing the tornado_settings through arguments of the Spawner with the following code:
c.Spawner.args = [“–ServerApp.tornado_settings= "cookie_options": {"SameSite": "None","Secure": True }, "xsrf_cookie_kwargs": {"httponly": True,"secure": True,"expires_days":1} }"]
But the jupyterHub service is giving me this error:
Nov 13 19:39:07 myserver python3[205310]: [E 2023-11-13 19:39:07.546 JupyterHub user:884] Unhandled error starting user_my’s server: ‘“xsrf_cookie_kwargs”’
Nov 13 19:39:07 myserver python3[205310]: Traceback (most recent call last):
Nov 13 19:39:07 myserver python3[205310]: File “/opt/tljh/hub/lib/python3.11/site-packages/jupyterhub/user.py”, line 798, in spawn
Nov 13 19:39:07 myserver python3[205310]: url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
Nov 13 19:39:07 myserver python3[205310]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 13 19:39:07 myserver python3[205310]: File “/opt/tljh/hub/lib/python3.11/site-packages/systemdspawner/systemdspawner.py”, line 334, in start
Nov 13 19:39:07 myserver python3[205310]: args=[self._expand_user_vars(a) for a in self.get_args()],
Nov 13 19:39:07 myserver python3[205310]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 13 19:39:07 myserver python3[205310]: File “/opt/tljh/hub/lib/python3.11/site-packages/systemdspawner/systemdspawner.py”, line 334, in
Nov 13 19:39:07 myserver python3[205310]: args=[self._expand_user_vars(a) for a in self.get_args()],
Nov 13 19:39:07 myserver python3[205310]: ^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 13 19:39:07 myserver python3[205310]: File “/opt/tljh/hub/lib/python3.11/site-packages/systemdspawner/systemdspawner.py”, line 182, in _expand_user_vars
Nov 13 19:39:07 myserver python3[205310]: return string.format(USERNAME=self.user.name, USERID=self.user.id)
Nov 13 19:39:07 myserver python3[205310]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 13 19:39:07 myserver python3[205310]: KeyError: ‘“xsrf_cookie_kwargs”’
Nov 13 19:39:07 myserver python3[205310]:
Nov 13 19:39:07 myserver python3[205310]: [E 2023-11-13 19:39:07.721 JupyterHub pages:313] Error starting server user_my: ‘“xsrf_cookie_kwargs”’
Nov 13 19:39:07 myserver python3[205310]: Traceback (most recent call last):
Nov 13 19:39:07 myserver python3[205310]: NoneType: None
Nov 13 19:39:07 myserver python3[205310]:
Nov 13 19:39:07 myserver python3[205310]: [W 2023-11-13 19:39:07.722 JupyterHub web:1869] 500 GET /hub/spawn/user_my (10.225.46.126): Unhandled error starting server user_my
Someone can help me? Is there any other option to secure all the xsrf cookies ?