talira

Hot Cell

Securely run untrusted code on untrusted inputs

open sourceMITself-hostablefree

Hot Cell moves risky work on untrusted files (image, video and PDF processing above all) out of a Rails app into an unprivileged sidecar container with no network, no credentials and nothing worth stealing. The app calls an ordinary Ruby method; Hot Cell passes the input and output files as descriptors over a UNIX socket and runs the work in a forked worker under limits on memory, time and disk. For Active Storage it ships drop-in analyzers, transformers and previewers, so libvips, FFmpeg and LibreOffice can leave the app image; custom operations use a #perform API. 37signals runs it in Basecamp, HEY and Fizzy, at about 8 ms per call.

Problems it solves

  • a crafted image upload could exploit libvips inside the container that holds our database credentials
  • process user-uploaded images, videos and PDFs somewhere that can't reach our network or secrets
  • sandbox Active Storage previews and variants without changing our application code
  • run a risky file conversion in a separate process with memory, time and disk limits
  • take ffmpeg and LibreOffice out of our main Rails image

Features

  • unprivileged sidecar container with no network or credentials
  • inputs and outputs as file descriptors over a UNIX socket
  • forked workers with memory, wall-clock and disk limits
  • drop-in Active Storage analyzers, transformers and previewers
  • custom operations with a #perform API
  • several cells per host
  • bring your own container image, checked by a conformance test

Limitations

  • The Active Storage gems need Rails 8.2, which hasn't been released yet1