Live data from Hacker News

Unix in the Browser Tab

browsix.org

41–50 of 79 posts

Re: Unix in the Browser Tab

#41

Earlier quoted context omitted.

Yes, I'm aware of this one, but it is using a cross-compiled TinyEMU, so it's a level of emulation away from what this is doing. https://bellard.org/jslinux/ [edit] Oh, I guess this isn't really what you were looking for. Whoops!

I really want to get this to work well, but haven't been able to. I have a small use case of customizing the image it presents and letting users be able to navigate/change/fix things on it. I've tried using containers and even VMs, but those are too heavy for what I need to do and I don't want to deal with snapshots to revert the image. Basically reloading the web page should do it. Wish I could get jslinux to work f…

https://copy.sh/v86/ is more modern but similar in spirit to jslinux. The archlinux demo at https://copy.sh/v86/ is particularly impressive.

Re: Unix in the Browser Tab

#42

I'd like to see Node.js running on it. I know StackBlitz has "WebContainers" but I'm looking for something open source.

Er, why? You want to run a JS implementation on top of a JS implementation?

(I'm not super familiar with this ecosystem so I'm probably missing something obvious like libraries or something)

Re: Unix in the Browser Tab

#43
post #15

Why not "stream" an image of an actual OS (say, linux) to the browser? Has anyone pulled that off yet? (Kind of like rendering services for example, the client is just for user interaction, everything else is streamed from server where all the computation happens)

https://guacamole.apache.org/ If I understood you correctly.

Xpra (see https://github.com/Xpra-org/xpra-html5) is very similar to Guacomole, except the backend Xpra server is written in Python (and Cython), whereas Guacomole's server is written in Java and C. Xpra native frontends, but also an html5 frontend that you can embed in web applications. For example, CoCalc provides a modified version of that html5 frontend to serve graphical X11 apps: https://cocalc.com/features/x11

Re: Unix in the Browser Tab

#44
I'm one of the authors - its so exciting to see continued interest here!

The biggest problem with Browsix today stems from Spectre mitigations: Shared Array Buffers aren't enabled by default in browsers, and static hosting sites like GitHub Pages don't let you set the right COOP/COEP ( https://web.dev/coop-coep/ ) headers to get them enabled AFAICT.

Additionally, Browsix hasn't been updated in a while, although I still believe the idea is sound. I don't have a lot of time for Browsix these days, but it would be straightforward to update Browsix with WASI support which would free us from having to use a modified Emscripten toolchain (and instantly enable running Rust binaries under Browsix).

[edit]: for additional context: we use Shared Array Buffers to give the kernel and program a shared view of a process's address space to enable fast system calls between Web Workers and the kernel (running in the main browser thread/context). Without them performance is unacceptably slow, as things like read/write system calls (a) require several memcpys and (b) create a bunch of JS garbage. Additionally, without them there isn't a good way to "block" handling a syscall in a WebWorker (which we need to do for non-event-loop C/C++/Rust programs).

Re: Unix in the Browser Tab

#47

As an alternative to maintaining an Emscripten fork, Browsix could be added as a new target to Zig.

I think there is a straightforward path to having Browsix generically support the WebAssembly WASI system interface[0] -- any toolchain that emitted binaries targeting that would then work in Browsix without e.g. Emscripting needing to know anything about Browsix.

0 - https://wasi.dev

Re: Unix in the Browser Tab

#49
post #40

This is amazing. I’m imagining all the ways I could use this for offensive security tools. If I had a way to import a js library that enabled running web servers, invoking OS commands, or running a reverse http proxy I’d be able to do so much damage to any target client.

It doesn't let you escape the browser sandbox.

> Sockets include support for TCP socket servers and clients, making it possible to run applications like databases and HTTP servers *together with their clients in the browser*.

Emphasis is mine. You need to run the server and the client within Browsix. Furthermore the "OS commands" are commands within the Browsix environment.

Re: Unix in the Browser Tab

#50
post #44

I'm one of the authors - its so exciting to see continued interest here! The biggest problem with Browsix today stems from Spectre mitigations: Shared Array Buffers aren't enabled by default in browsers, and static hosting sites like GitHub Pages don't let you set the right COOP/COEP ( https://web.dev/coop-coep/ ) headers to get them enabled AFAICT. Additionally, Browsix hasn't been updated in a while, although I sti…

If I'm reading this right, it means Shared Array Buffers can get enabled by sites that are not GitHub Pages, eg, by spinning up one's preferred cloud hosting instance (DO AWS Azure etc). If yes, then this appears in my mind as not a huge problem.
Post reply on HN