-
Notifications
You must be signed in to change notification settings - Fork 45
Examples of connecting to secured servers #251
Comments
@parente, any thoughts on the above? |
The demo project here: https://github.com/jupyter/kernel_gateway_demos/tree/master/node_client_example shows one pattern of securing access to kernel gateways via nginx using basic auth headers.
The shared token auth supported in the kernel gateway can also be used to authenticate connections, but:
|
Would there be interest in updating this package to make connecting to secure servers from nodejs a first-class usecase? So far the suggestions above have recommended alternative ways of setting up the notebook server itself, which may not be viable if the server is administered by a 3rd party. To get secure connections more working for hydrogen, I have released a hydrogen-auth plugin. Unfortunately, the amount of monkey-patching involved precludes this from being merged into the hydrogen package itself. In short, the changes required have been the following:
I think it would be useful to bring some of this functionality into the services package itself. Specifically, what I'm imagining is:
As for the same-origin policy bypass, the story there is that same-origin protections are designed to prevent rouge webpages from messing with your notebook server. But if you're running a nodejs package, it has (in principle) the same permissions as a browser -- same-origin policy would not be effective in preventing malicious code. Rather than having to reconfigure notebook servers and disable CORS, it makes more sense for a program like hydrogen to spoof the Host headers to achieve full functionality. If the services is able to use custom classes to make web requests (as opposed to overriding globals), it could therefore be used in this manner without compromising other web requests in the same process. Any thoughts? |
I am comfortable if you want to submit PRs for the dependency injection and the login parts, but should defer to @minrk on the CORS issue. |
With jupyter/notebook#1831, notebook 4.3 will allow authenticating with the same I'll have to double-check the CORS stuff. You are right that requests from nodejs shouldn't trigger CORS. One way is to spoof the headers, but if I recall, one or both of Origin/Host are not set on requests from a script. The CORS checks shouldn't apply in that case, but maybe node does something different to what I've worked with in python-requests/cURL. On the case! |
#281 adds a top-level option for jupyter/notebook#1903 should address the cross-origin websockets issue. |
Hi, I'm working on remote kernel functionality in nteract/hydrogen, using this services package.
Lately we've had several reports of being unable to configure secure connections (see nteract/hydrogen#467 and nteract/hydrogen#473). I'm trying to address these issues, but there doesn't appear to be any documentation on how to connect
jupyter-js-services
to a secured server (be it a notebook server or a kernel gateway).Could someone involved with
jupyter-js-services
or the Jupyter project help me out here?Based on crawling a scattering of github issues, websites, and mailing list posts, my current understanding of the situation is:
KG_AUTH_TOKEN
and passingrequestHeaders.Authorization
, which allows accessing the HTTP-based API. However attempting to actually connect to a kernel over websockets does not pass the required credentials, and I haven't come across any documentation on how to get the websocket connection to proceed.It is my belief that supporting community-made frontends is beneficial for the Jupyter community, and the kernel gateway + jupyter-js-services combination provides a good foundation for this. However, I think that being able to establish secure connections is an important part of this story. I'd appreciate if someone could help me get this feature working.
Thanks!
The text was updated successfully, but these errors were encountered: