-
Notifications
You must be signed in to change notification settings - Fork 131
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
Support notebook 4.3 token generation (or equivalent) #211
Comments
The tokens in notebook as for one-time use, with the traditional cookie serving as the proof of authentication thereafter. That won't work for KG use cases where a cookie jar may not be available. I think having an option to generate a secure token if one is not provided, and accepting that token as a URL parameter, especially on web socket connections, is the way to go. |
I've just been trying to connect to a kernel gateway with auth token through a node.js program using the jupyterlab/services client. I can list kernel specs and running kernels. But when the web sockets come into play, after starting a kernel or when trying to execute code, things fail. The client reports loss of connection, and the kernel gateway a write error. I assume that this is because the kernel gateway doesn't understand the token being passed as a URL parameter to the web socket? client output:
kernel gateway output:
Would it be possible to fix just the authentication part, without introducing token generation, in the 1.x series? I don't know to what degree the breaking API changes in 2.0 would affect our planned setup. Another direction I was pondering is to enable basic auth alongside token auth in KG. The web socket authentication with basic auth works against Bluemix Spark as a Service when username and password are encoded in the URL. By enabling basic auth in KG proper, we could use the same trick without an authentication proxy. |
This seems to be the place... And the corresponding code in notebook... So there is no distinction between web socket and plain request authentication. Both will work with a token either in the Authorization header or as a URL parameter. A token passed as URL parameter takes precedence over one passed in the Authorization header. From a gut feeling, I would have done it the other way round. |
The current KG release doesn't understand tokens for websockets yet. |
I think the only thing required to close this out is the option of automatically generating a token. We could take a security-first approach in 2.1 and start doing that by default if the user does not specify a blank or explicit token. This is the approach that jupyter/notebook took in 4.3. Or, we can remain backward compatible with existing kernel gateway apps and insecure by default, yet have a way for a user to specify that a random token should be generated at startup. I think security-first plus keeping the KG and original notebook server as closely aligned as possible is the way to go. |
We can expose the 4.3 token feature. Or it might be simpler to implement the same random token generation scheme and use the auth handlers already mixed into the various classes here.
The main significant difference between what's here and in nb 4.3 is the support for tokens as query params in addition to headers. This allows the use of a token on the websocket URL. It should be easy to support that here as well.
I've one worry: the further diverging code bases between KG and notebook.
The text was updated successfully, but these errors were encountered: