Live data from Hacker News

Livebook: A collaborative and interactive code notebook for Elixir

dashbit.co

51–60 of 87 posts

Re: Livebook: A collaborative and interactive code notebook for Elixir

#51
post #4

"connect to an existing node" is going to be amazing. I imagine two interesting uses for this. 1. producing reports. Connect a livebook session to your system in prod, run a livebook (which pulls data from DB eg), then get back a report. User engagement, cloud resources consumed, p90s, or an incident report... 2. manual database intervention. Suppose you need to manually make a batch of changes to the DB. It would be…

Be careful, websockets are tricky to secure and get right. It's easy to do something like forget to check the origin and now you've opened up a whole class of cross-site websocket scripting attacks. I love the idea of easy access and nice UI to prod machines, but put it behind a secure proxy or VPN layer and not facing the public internet.

Hmmm.

Nginx has an auth_subrequest module that yeets all the cookies in a requests over to a configured URL in a server-initiated subrequest (hence the name), then proceeds with the original request only if the subrequest returns 200 OK. The module works with any type of incoming request, including FastCGI and reverse proxy situations.

The idea is that some config magic turns the 401 into a 302 redirect that walks you through a single-signon page, then you get redirected back to wherever you left off. However since you can make failed requests do just about anything you could technically reroute the request to a WebSocket server that just serves error responses or something, but that feels very... wronky.

The module does feel somewhat unwieldy to use in general as well, although this may be due to general unfamiliarity on my part with Nginx's way of doing things (which I'd summarize as "AAAAAAaaaaaaaa (aaa!)"). (The whole `if`-statements-can-SEGV thing etc.)

The module can only return 200 (allow original request through) or 401 (deny original request); any other response causes nginx to cancel the original request and return 503. (In case of 401, anything else, or error, the FastCGI server or upstream never sees a connection at all.)

It's possible to pass interesting state information such as a username or non-opaque session token from the subrequest to the main request by capturing subrequest response headers then injecting them as request headers into the main request, but this is sufficiently into the weeds (and unlike any existing system Web developers would typically have experience with) that I have a strong tendency to just go \ N O \, but considering that it is admittedly an obscure yet established corner of nginx's configuration, I figured I'd say something for completeness... for the benefit of the 2 people still reading up to this point. :D

I've incidentally been trying to figure out how to set up a simple BeyondCorp-esque system with it for a while now (for remote access to home systems, so focusing mostly focusing on brain-dead simplicity), but the giant brick wall I keep running into is how to a) make things auth-aware, b) keep the cookie properly opaque, and b) prevent everything from exploding horribly if auth_subrequest gets turned off. The only method I can think of to enable (b) (so that individual services don't have to duplicate auth logic, kind of defeats the point) is to pass headers out from the subrequest, which then breaks (c) (making it possible to access things directly).

A small microservice that handles the cookie side of things and makes HTTP requests itself starts looking like a breath of fresh air...

Re: Livebook: A collaborative and interactive code notebook for Elixir

#53
post #26

Earlier quoted context omitted.

'Connect to an existing node' is likely implemented using ERTS ( http://erlang.org/doc/reference_manual/distributed.html ). So you're basically connecting to the runtime of the target node. The security model for ERTS isn't great, though, so your point stands. All you need is a matching secure cookie and you can connect and run any commands you want.

To put context on that - it's still TLS, the cookie is just a password. The problem is that it's one password for the node network, and you either have it, or you don't. So there's no real administrative control over access; it's shared password.

And a browser can be tricked into sending the cookie if you accidentally misconfigure the server. You will have no indication or warning of this happening, from either the client or server side, if you get it wrong.

Re: Livebook: A collaborative and interactive code notebook for Elixir

#55
post #15

So this is like Jupyter notebooks for Elixir?

With google docs style collaborative editing, can connect to an existing cluster to run code in it. You can run one instance of the Livebook application and have different livebook docs run for different Elixir projects you happen to be working on. Not sure what parts are in Jupyter but I've heard collab editing isn't. Pretty hype about trying this for some living docs and teaching. Will see if I can do anything neat…

I used to teach my viewers of the basics of Elixir. It's in Brazilian Portuguese, but it's kinda interesting how easy is to use Livebook and show some code for people.

https://www.twitch.tv/videos/991797943

Re: Livebook: A collaborative and interactive code notebook for Elixir

#56
post #13

Earlier quoted context omitted.

It is growing and having good adoption. Not a huge language but it also has a fair share of novel features (being built on Erlang) that aren't commonly seen with other langs. So I think it might have a disproportionate visibility compared to size. Lots of work happening in the community, lots of ambitious ideas and releases.

Why do you say its growing?

It recently hit top 50 on one of the big lists of programming languages and I see more people getting into it every day. It is growing unless there's s lsrge drain hole somewhere. Might not be growing relative to other larger langs but I'm fairly certain it is growing.

And I've heard a lot of concern about it being niche so I tend to mention that it is growing. Because in my experience the biche is quite large and .. growing. I find plenty of work.

Re: Livebook: A collaborative and interactive code notebook for Elixir

#57

Earlier quoted context omitted.

To put context on that - it's still TLS, the cookie is just a password. The problem is that it's one password for the node network, and you either have it, or you don't. So there's no real administrative control over access; it's shared password.

And a browser can be tricked into sending the cookie if you accidentally misconfigure the server. You will have no indication or warning of this happening, from either the client or server side, if you get it wrong.

>> if you accidentally misconfigure the server

Sure, but I mean...

Re: Livebook: A collaborative and interactive code notebook for Elixir

#58

If I'm a data scientists with a bunch of existing Python notebooks can I use this product?

Not yet. It only supports Elixir for now (there is an issue for supporting other languages) and the notebook formats are different, so someone would also need to write a nbconvert to Markdown (.livemd).

Re: Livebook: A collaborative and interactive code notebook for Elixir

#59
post #56

Earlier quoted context omitted.

Why do you say its growing?

It recently hit top 50 on one of the big lists of programming languages and I see more people getting into it every day. It is growing unless there's s lsrge drain hole somewhere. Might not be growing relative to other larger langs but I'm fairly certain it is growing. And I've heard a lot of concern about it being niche so I tend to mention that it is growing. Because in my experience the biche is quite large and ..…

There's quite a disconnect between the amount of attention it gets on HN and the fact it's not in the top 40 languages. I mean Tiobe index has it behind Lua, Lisp and RPG (?). So yes you can definitely say it's a niche.
Post reply on HN