ƒɪᴏʟɪɴ -- Design Doc

A Fiddle For Files

tl;dr: Write simple scripts that manipulate files. Share them with your friends. Run them entirely in your browser.

Motivation and Overview

Personal computing has turned out differently than I imagined. We all carry around pocket sized super-computers 100 million times more powerful than the Apple IIɢꜱ I played Oregon Trail on as a child. A million books or two years of audio can fit onto an SD card the size of my fingernail. Programming is the most accessible it has ever been: compilers cost nothing; tutorials, books, and courses are numerous and mostly free; and thousands upon thousands of open-source libraries are just a few clicks away.

And yet. No one ever installs software unless it's been personally approved by Gabe Newell or the ghost of Steve Jobs. Our super-computers act mostly as dumb terminals. All our files live in a data center in Virginia anyway, and as for songs, we don't actually own any to begin with. When faced with simple math problems, we find it most convenient to use the immense computational might of our computers to send the question over to OpenAI, where an artificial mind that is fluent in English and many other languages will decide, after some contemplation, to delegate the task to a calculator, since arithmetic isn't really its strong suit.

To put it mildly, there is a big gap between what a programmer can achieve locally on their own computer and what a non-programmer is typically able to do on theirs. And there's very little a programmer can do to easily share their creations with their non-programmer friends and relatives.

Fiolin's thesis is this:

Design

Fiolin is composed of several pieces: the UI, the script runner, the scripts themselves, and any libraries needed by the scripts.

Security

Fiolin is intended to allow for two classes of users to interact safely:

These safety properties are primarily provided by CSPs, but I try to characterize what the security properties are for my other technical choices as well.

Content Security Policies

Web Workers

The script runner is not running in the main browser thread itself but rather in a web-worker. The main thread/worker boundary isn't conceptualized as a sandbox by the standard, but it is nonetheless true that workers do not have access to the window object or, indeed, direct access to any objects from the main thread. Instead, there is an alternate context object (self) that supports a subset of what window does (most obviously no access to the DOM), and the worker can communicate with the main thread via messages. The messages can contain objects, but only those that can be serialized. In Fiolin, communication between the worker and main thread takes place through some very narrowly scoped message types. Within the worker, the only functions of security relevance are fetch and importScript. These are constrained by the CSP.

WASM

WASM itself provides an excellent sandbox for the code running in it. However, emscripten can easily blow huge holes in the sandbox when, for example, you link in support for sockets. The compiled artifacts include both the sandboxed WASM and the (sandbox compromising) javascript glue code in a big unreadable bundle. It will require some additional work to characterize what threats WASM-in-Fiolin will bring, but again, the ability to use anything gained here is mitigated by the CSP of the worker.

Pyodide

My basic opinion is that pyodide itself is not all that well sandboxed, but there are several mitigations:

Caveats

Alternatives Considered