{"action":"created","issue":{"url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/124","repository_url":"https://api.github.com/repos/jupyterhub/dockerspawner","labels_url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/124/comments","events_url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/124/events","html_url":"https://github.com/jupyterhub/dockerspawner/pull/124","id":183746793,"number":124,"title":"Allow username to contain illegal volume characters like @","user":{"login":"namdets","id":3311344,"avatar_url":"https://avatars.githubusercontent.com/u/3311344?v=3","gravatar_id":"","url":"https://api.github.com/users/namdets","html_url":"https://github.com/namdets","followers_url":"https://api.github.com/users/namdets/followers","following_url":"https://api.github.com/users/namdets/following{/other_user}","gists_url":"https://api.github.com/users/namdets/gists{/gist_id}","starred_url":"https://api.github.com/users/namdets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namdets/subscriptions","organizations_url":"https://api.github.com/users/namdets/orgs","repos_url":"https://api.github.com/users/namdets/repos","events_url":"https://api.github.com/users/namdets/events{/privacy}","received_events_url":"https://api.github.com/users/namdets/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-18T17:05:37Z","updated_at":"2016-10-28T18:03:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jupyterhub/dockerspawner/pulls/124","html_url":"https://github.com/jupyterhub/dockerspawner/pull/124","diff_url":"https://github.com/jupyterhub/dockerspawner/pull/124.diff","patch_url":"https://github.com/jupyterhub/dockerspawner/pull/124.patch"},"body":"While working with third party oauth providers for authentication(using oauthenticator's Google example), I ran into an issue where the Google oauth provider returned an email as the username. When naming the docker container the username was being escaped, but when naming the volume it was not. This was causing Docker to explode resulting in the following stack trace:\r\n\r\n[I 2016-10-18 15:26:42.667 JupyterHub dockerspawner:332] Container 'jupyter-user_40email_2Ecom' is gone\r\n[W 2016-10-18 15:26:42.668 JupyterHub dockerspawner:303] container not found\r\n[E 2016-10-18 15:26:42.699 JupyterHub web:1524] Uncaught exception GET /hub/user/user@email.com (x.x.x.x)\r\n    HTTPServerRequest(protocol='https', host='localhost', method='GET', uri='/hub/user/user@email.com', version='HTTP/1.1', remote_ip='x.x.x.x', headers={'Host': 'localhost', 'Referer': 'https://localhost/hub/home', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116 Chrome/52.0.2743.116 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Upgrade-Insecure-Requests': '1', 'Cookie': 'jupyter-hub-token=\"2|1:0|10:1476801982|17:jupyter-hub-token|44:OWIwODc1YzhhN2Y4NDJjN2E2NzQ1NDFjMWE4YzRiMmQ=|d343f8c1ab24a119ab45a29753bf2b2fe36d390dbd5970ef5ba836dd9fe19c79\"', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https', 'X-Forwarded-For': 'x.x.x.x', 'Connection': 'close', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch, br'})\r\n    Traceback (most recent call last):\r\n      File \"/opt/conda/lib/python3.5/site-packages/tornado/web.py\", line 1445, in _execute\r\n        result = yield result\r\n      File \"/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py\", line 494, in get\r\n        yield self.spawn_single_user(current_user)\r\n      File \"/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py\", line 312, in spawn_single_user\r\n        yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)\r\n      File \"/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py\", line 247, in spawn\r\n        raise e\r\n      File \"/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py\", line 228, in spawn\r\n        yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)\r\n      File \"/srv/jupyterhub/dockerspawner/dockerspawner/dockerspawner.py\", line 391, in start\r\n        resp = yield self.docker('create_container', **create_kwargs)\r\n      File \"/opt/conda/lib/python3.5/concurrent/futures/_base.py\", line 398, in result\r\n        return self.__get_result()\r\n      File \"/opt/conda/lib/python3.5/concurrent/futures/_base.py\", line 357, in __get_result\r\n        raise self._exception\r\n      File \"/opt/conda/lib/python3.5/concurrent/futures/thread.py\", line 55, in run\r\n        result = self.fn(*self.args, **self.kwargs)\r\n      File \"/srv/jupyterhub/dockerspawner/dockerspawner/dockerspawner.py\", line 289, in _docker\r\n        return m(*args, **kwargs)\r\n      File \"/opt/conda/lib/python3.5/site-packages/docker/api/container.py\", line 135, in create_container\r\n        return self.create_container_from_config(config, name)\r\n      File \"/opt/conda/lib/python3.5/site-packages/docker/api/container.py\", line 146, in create_container_from_config\r\n        return self._result(res, True)\r\n      File \"/opt/conda/lib/python3.5/site-packages/docker/client.py\", line 178, in _result\r\n        self._raise_for_status(response)\r\n      File \"/opt/conda/lib/python3.5/site-packages/docker/client.py\", line 174, in _raise_for_status\r\n        raise errors.APIError(e, response, explanation=explanation)\r\n    docker.errors.APIError: 500 Server Error: Internal Server Error (\"b'{\"message\":\"create jupyterhub-user-user@email.com: \\\\\"jupyterhub-user-user@email.com\\\\\" includes invalid characters for a local volume name, only \\\\\"[a-zA-Z0-9][a-zA-Z0-9_.-]\\\\\" are allowed\"}'\")\r\n    \r\n[E 2016-10-18 15:26:42.792 JupyterHub log:99] {\r\n      \"Host\": \"localhost\",\r\n      \"Referer\": \"https://localhost/hub/home\",\r\n      \"User-Agent\": \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116 Chrome/52.0.2743.116 Safari/537.36\",\r\n      \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\",\r\n      \"Upgrade-Insecure-Requests\": \"1\",\r\n      \"Cookie\": \"jupyter-hub-token=\\\"2|1:0|10:1476801982|17:jupyter-hub-token|44:OWIwODc1YzhhN2Y4NDJjN2E2NzQ1NDFjMWE4YzRiMmQ=|d343f8c1ab24a119ab45a29753bf2b2fe36d390dbd5970ef5ba836dd9fe19c79\\\"\",\r\n      \"X-Forwarded-Port\": \"443\",\r\n      \"X-Forwarded-Proto\": \"https\",\r\n      \"X-Forwarded-For\": \"x.x.x.x\",\r\n      \"Connection\": \"close\",\r\n      \"Accept-Language\": \"en-US,en;q=0.8\",\r\n      \"Accept-Encoding\": \"gzip, deflate, sdch, br\"\r\n    }\r\n[E 2016-10-18 15:26:42.793 JupyterHub log:100] 500 GET /hub/user/user@email.com (user@email.com@x.x.x.x) 411.14ms\r\n\r\n\r\nThe fix implemented was to call self.escaped_name instead of self.user.name in _volumes_to_binds, I'm new to the project, so please let me know if this is wrong. I did add a test case as well as test it in jupyterhub.\r\n\r\nI don't think this will break any existing installations on upgrade as the volumes could not have been created before.\r\n"},"comment":{"url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/comments/256988014","html_url":"https://github.com/jupyterhub/dockerspawner/pull/124#issuecomment-256988014","issue_url":"https://api.github.com/repos/jupyterhub/dockerspawner/issues/124","id":256988014,"user":{"login":"namdets","id":3311344,"avatar_url":"https://avatars.githubusercontent.com/u/3311344?v=3","gravatar_id":"","url":"https://api.github.com/users/namdets","html_url":"https://github.com/namdets","followers_url":"https://api.github.com/users/namdets/followers","following_url":"https://api.github.com/users/namdets/following{/other_user}","gists_url":"https://api.github.com/users/namdets/gists{/gist_id}","starred_url":"https://api.github.com/users/namdets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namdets/subscriptions","organizations_url":"https://api.github.com/users/namdets/orgs","repos_url":"https://api.github.com/users/namdets/repos","events_url":"https://api.github.com/users/namdets/events{/privacy}","received_events_url":"https://api.github.com/users/namdets/received_events","type":"User","site_admin":false},"created_at":"2016-10-28T18:03:17Z","updated_at":"2016-10-28T18:03:17Z","body":"Maybe this is more what you had in mind?\r\n\r\nI like keeping the naming strategies in a separate file to encourage future implementations to be contributed back. \r\n\r\nAlso, I would still like to build in some tests for the extension config itself as well as each strategy.\r\n\r\n"}}
{"actor":{"display_login":"namdets"}}