As a data science deployment platform, ricochet enables developers to deploy, execute, and run arbitrary code at scale.
Doing this, though, is inherently dangerous. A malicious, R, Julia, or Python script could delete important files, send sensitive information, or a plethora of other bad-actor behaviors.
To keep your code safe, we created a tiny Rust library called crostini 🥖.
Quarantine everything! đź§Ľ
Ricochet keeps you, your code, and your organization safe by running every single process in isolation. Each app and task can only see the files it was deployed with. This means that each Shiny app in R, Julia script, or Python API can’t go snooping around.
Ricochet supports 3 different backend engines:
- Host
- Kubernetes
- Container (Podman or Docker)
“Host” means it creates processes on the machine that ricochet is installed on.
On Linux hosts, we run everything in an isolated, rootless container runtime written in safe Rust.
Zero dependency containerization
We’ve spent a lot of time and energy making sure we run your code safely, quickly, and with as little configuration as possible.
Normally, running a rootless container requires an external system dependency such as Docker or Podman. Ricochet, however, is completely dependency-free.
To do this, we built a runtime from scratch that creates rootless containers natively. We based our runtime on youki, a pure-Rust and OCI-compliant runtime. This enables us to create a secure, rootless, environment without any external platform configuration.
Forking with Crostini
To create a rootless runtime on Linux you have to created a “forked” process.
A typical new process can see (almost) everything.
When we create the forked process we give it the process ID (PID) of 1.
The PID 1 is a special process that owns everything.
This new process thinks it is the init(ial) process cannot see anything else.
Creating a forked process, in essence, hides everything from the new process.
This is where crostini, our tasty morsel of pure rust, comes in.
The industry standard is to use tools such as tini or catatonit to do this isolation.
That, though, requires shipping and orchestrating an external dependency which we’d like to avoid whenever possible!
You maye have seen a Dockerfile that looks like so:
ENTRYPOINT ["/tini", "--"]
CMD ["/your/program", "-and", "-its", "arguments"]This wraps /your/program using tini which manages the process.
crostini does this in our compiled rust binary instead—thus, no external depencies needed!
Cleaning up the crumbs
After creating the forked process, the underlying process thinks it is the only one.
Because of that, it ignores any incoming signals.
crostini’s only job, then, is to babysit the existing process and takes on the responsibility for handling any incoming signals, forwarding them, and appropriately terminating the underlying process.
This deceptively simple and small crate gives us the confidence to enable developers to deploy anything they’d like while protecting the underlying host.